Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise(function(resolve) {
let toTest = `${path}@${value}`;
let cachedState = packageCache[toTest];
if (cachedState !== undefined) {
if (cachedState === true) {
console.log('good:', toTest, '(from cache)');
} else {
delete versions[value];
console.log('bad:', toTest, '(from cache)');
}
resolve();
} else {
Snyk.test(toTest).then(function (data) {
if (data.ok !== true) {
console.log('bad:', toTest);
packageCache[toTest] = false;
delete versions[value];
} else {
packageCache[toTest] = true;
console.log('good:', toTest);
}
resolve();
cacheChanged = true;
}, function (data) {
let sanitized = data || {};
if (sanitized.ok !== true) {
console.log('bad:', toTest);
packageCache[toTest] = false;