mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 14:02:03 +02:00
Initial commit
This commit is contained in:
7
node_modules/content-security-policy-builder/dist/index.d.ts
generated
vendored
Normal file
7
node_modules/content-security-policy-builder/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
interface PolicyBuilderOptions {
|
||||
directives: {
|
||||
[directive: string]: string[] | string | boolean;
|
||||
};
|
||||
}
|
||||
declare const _default: ({ directives }: PolicyBuilderOptions) => string;
|
||||
export = _default;
|
33
node_modules/content-security-policy-builder/dist/index.js
generated
vendored
Normal file
33
node_modules/content-security-policy-builder/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
function dashify(str) {
|
||||
return str
|
||||
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
||||
.toLowerCase();
|
||||
}
|
||||
module.exports = function (_a) {
|
||||
var directives = _a.directives;
|
||||
var keysSeen = {};
|
||||
return Object.keys(directives).reduce(function (result, originalKey) {
|
||||
var directive = dashify(originalKey);
|
||||
if (keysSeen[directive]) {
|
||||
throw new Error(originalKey + " is specified more than once");
|
||||
}
|
||||
keysSeen[directive] = true;
|
||||
var value = directives[originalKey];
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(' ');
|
||||
}
|
||||
else if (value === true) {
|
||||
value = '';
|
||||
}
|
||||
else if (value === false) {
|
||||
return result;
|
||||
}
|
||||
if (value) {
|
||||
return result.concat(directive + " " + value);
|
||||
}
|
||||
else {
|
||||
return result.concat(directive);
|
||||
}
|
||||
}, []).join('; ');
|
||||
};
|
Reference in New Issue
Block a user