upload site
This commit is contained in:
commit
69c5b90d6a
3300 changed files with 224783 additions and 0 deletions
22
node_modules/helmet-csp/dist/lib/check-options/check-directive/require-sri-for.js
generated
vendored
Normal file
22
node_modules/helmet-csp/dist/lib/check-options/check-directive/require-sri-for.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var config_1 = __importDefault(require("../../config"));
|
||||
var is_function_1 = __importDefault(require("../../is-function"));
|
||||
module.exports = function requireSriForCheck(key, value) {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new Error("\"" + value + "\" is not a valid value for " + key + ". Use an array of strings.");
|
||||
}
|
||||
if (value.length === 0) {
|
||||
throw new Error(key + " must have at least one value. To require nothing, omit the directive.");
|
||||
}
|
||||
value.forEach(function (expression) {
|
||||
if (is_function_1.default(expression)) {
|
||||
return;
|
||||
}
|
||||
if (config_1.default.requireSriForValues.indexOf(expression) === -1) {
|
||||
throw new Error("\"" + expression + "\" is not a valid " + key + " value. Remove it.");
|
||||
}
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue