content-security-policy-parser
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

Content Security Policy parser

Take a Content Security Policy string and parse it via the spec.

Usage:

import parseContentSecurityPolicy from "content-security-policy-parser";

parseContentSecurityPolicy(
  "default-src 'self'; script-src 'unsafe-eval' scripts.example; object-src; style-src styles.example",
);
// => Map(4) {
//      "default-src" => ["'self'"],
//      "script-src" => ["'unsafe-eval'", "scripts.example"],
//      "object-src" => [],
//      "style-src" => ["styles.example"],
//    }

This module is considered "complete". I expect to continue maintenance if needed, but I don't plan to add features or make breaking changes.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.6.0
    20,224
    • latest

Version History

Package Sidebar

Install

npm i content-security-policy-parser

Weekly Downloads

59,985

Version

0.6.0

License

MIT

Unpacked Size

11.4 kB

Total Files

10

Last publish

Collaborators

  • evanhahn