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/index.js
generated
vendored
Normal file
22
node_modules/helmet-csp/dist/lib/check-options/index.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 dasherize_1 = __importDefault(require("dasherize"));
|
||||
var check_directive_1 = __importDefault(require("./check-directive"));
|
||||
function isObject(value) {
|
||||
return Object.prototype.toString.call(value) === '[object Object]';
|
||||
}
|
||||
module.exports = function (options) {
|
||||
if (!isObject(options)) {
|
||||
throw new Error('csp must be called with an object argument. See the documentation.');
|
||||
}
|
||||
var directives = options.directives;
|
||||
if (!isObject(directives) || Object.keys(directives).length === 0) {
|
||||
throw new Error('csp must have at least one directive under the "directives" key. See the documentation.');
|
||||
}
|
||||
Object.keys(directives).forEach(function (directiveKey) {
|
||||
var typedKey = directiveKey;
|
||||
check_directive_1.default(dasherize_1.default(directiveKey), directives[typedKey], options);
|
||||
});
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue