UNPKG

csp-builder

Version:

A builder tool to help generate Content Security Policies in a type-safe way

19 lines (18 loc) 353 B
export class AbstractToggleDirective { constructor() { this.state = false; } toggle(value) { this.state = value; return this; } getMinimumCspVersion() { return 1; } serialize() { if (!this.state) { return ''; } return `${this.getDirectiveName()};`; } }