UNPKG

csp-builder

Version:

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

19 lines (18 loc) 373 B
export class AbstractSingleValueDirective { constructor() { this.state = null; } setValue(value) { this.state = value; return this; } getMinimumCspVersion() { return 1; } serialize() { if (!this.state) { return ''; } return `${this.getDirectiveName()} ${this.state};`; } }