snyk-policy
Advanced tools
Comparing version 1.24.0 to 1.25.0
module.exports = addExclude; | ||
function addExclude(policy, pattern, group='global') { | ||
function addExclude(policy, pattern, group = 'global', options = {}) { | ||
if (!isPatternGroupValid(group)) { | ||
@@ -8,15 +8,19 @@ throw new Error('invalid file pattern-group'); | ||
policy.exclude = policy.exclude ? policy.exclude: {}; | ||
policy.exclude = policy.exclude || {}; | ||
const patterns = policy.exclude[group] ? policy.exclude[group]: []; | ||
let patterns = policy.exclude[group] || []; | ||
if (patterns.includes(pattern)) { | ||
return; // Exit early, to prevent duplication | ||
} | ||
// Remove duplicates | ||
patterns = patterns.filter((p) => p !== pattern && !p[pattern]); | ||
policy.exclude[group] = [...patterns, pattern]; | ||
options.created = new Date(); | ||
const entry = | ||
!options.expires && !options.reason ? pattern : { [pattern]: options }; | ||
policy.exclude[group] = [...patterns, entry]; | ||
} | ||
function isPatternGroupValid(group) { | ||
return ['global', 'code'].includes(group); | ||
return ['global', 'code', 'iac-drift'].includes(group); | ||
} |
@@ -46,3 +46,3 @@ { | ||
}, | ||
"version": "1.24.0" | ||
"version": "1.25.0" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44293
1010