Socket
Socket
Sign inDemoInstall

snyk-policy

Package Overview
Dependencies
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-policy - npm Package Compare versions

Comparing version 1.24.0 to 1.25.0

20

lib/add-exclude.js
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);
}

2

package.json

@@ -46,3 +46,3 @@ {

},
"version": "1.24.0"
"version": "1.25.0"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc