Simple and correct Content-Security-Policy parser and serializer using ES6 Maps and Sets.
example_policy = "default-src 'none'; script-src 'nonce-ExamplePolicyTests'; sandbox; connect-src https: 'self'; img-src 'self'; style-src 'self'" policy = csp policy instanceof Map // truepolicy instanceof Set // true // remove directivespolicy // modify directivespolicy // replace directivespolicy // serialize back to a stringcsp // "default-src 'none'; script-src 'self' 'unsafe-eval'; connect-src https: 'self'; img-src 'self'; style-src 'self'"