Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

content-security-policy-parser

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-security-policy-parser - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

6

CHANGELOG.md
# Changelog
## 0.4.1 - 2022-03-23
### Changed
- Shrink package size slightly
## 0.4.0 - 2020-12-22

@@ -4,0 +10,0 @@

18

dist/index.js
"use strict";
module.exports = (policy) => policy.split(";").reduce((result, directive) => {
const [directiveKey, ...directiveValue] = directive.trim().split(/\s+/g);
if (directiveKey &&
!Object.prototype.hasOwnProperty.call(result, directiveKey)) {
// Mutating `reduce`'s result is typically discouraged, but we do it here for performance.
result[directiveKey] = directiveValue;
}
module.exports = (policy) => {
const result = {};
policy.split(";").forEach((directive) => {
const [directiveKey, ...directiveValue] = directive.trim().split(/\s+/g);
if (directiveKey &&
!Object.prototype.hasOwnProperty.call(result, directiveKey)) {
result[directiveKey] = directiveValue;
}
});
return result;
}, {});
};

@@ -5,3 +5,3 @@ {

"description": "Parse Content Security Policy directives.",
"version": "0.4.0",
"version": "0.4.1",
"license": "MIT",

@@ -41,5 +41,5 @@ "keywords": [

"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint \"**/*.ts\"",
"lint:prettier": "prettier --check \"**/*.{md,js,json,ts}\"",
"format": "prettier --write \"**/*.{md,js,json,ts}\"",
"lint:eslint": "eslint .",
"lint:prettier": "prettier --check .",
"format": "prettier --write .",
"clean": "rm -rf dist",

@@ -50,11 +50,11 @@ "build": "npm run clean && tsc",

"devDependencies": {
"@types/jest": "^26.0.19",
"@typescript-eslint/eslint-plugin": "^4.11.0",
"@typescript-eslint/parser": "^4.11.0",
"eslint": "^7.16.0",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
"@types/jest": "^27.4.1",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"jest": "^27.5.1",
"prettier": "^2.6.0",
"ts-jest": "^27.1.3",
"typescript": "^4.6.2"
}
}
# Content Security Policy parser
[![Build Status](https://travis-ci.org/helmetjs/content-security-policy-parser.svg?branch=master)](https://travis-ci.org/helmetjs/content-security-policy-parser)
Take a Content Security Policy string and parse it.

@@ -6,0 +4,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc