Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
trim whitespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
therealbenpai committed Mar 18, 2024
1 parent c5ff7d5 commit b38de0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion middleware/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WebSecurity {
/** @param {Array<ReportingEndpoint>} data */
static ReportingEndpoints = (...data) => data.reduce((acc, ep) => acc += `${ep.id.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${ep.url}, `, '').slice(0, -2);
/** @param {Array<PermissionPolicy>} data */
static PermissionPolicy = (...data) => data.reduce((acc, {key, ...value}) => acc += `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}=${(value.wildcard) ? '*' : `(${(value.none) ? '' : `${(value.self) ? '\'self\' ' : ''}${(value.src) ? '\'src\' ' : ''}${(Array.isArray(value.domains) && value.domains) ? value.domains.map(v => `"${v}"`).join(' ') : ''}`})`}, `, '').slice(0, -2);
static PermissionPolicy = (...data) => data.reduce((acc, {key, ...value}) => acc += `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}=${(value.wildcard) ? '*' : `(${(value.none) ? '' : `${(value.self) ? '\'self\' ' : ''}${(value.src) ? '\'src\' ' : ''}${(Array.isArray(value.domains) && value.domains) ? value.domains.map(v => `"${v}"`).join(' ') : ''}`.trim()})`}, `, '').slice(0, -2);
/** @param {string} domain */
static CD = (domain) => [domain, `*.${domain}`];
}
Expand Down

0 comments on commit b38de0d

Please sign in to comment.