mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 22:12:02 +02:00
Initial commit
This commit is contained in:
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);
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user