Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
};
if (!err) {
locked = true;
this.logger.trace(
{
name
},
'[local-storage/updatePackage] file: @{name} has been locked'
);
}
if (_.isNil(err) === false) {
if (err.code === resourceNotAvailable) {
return unLockCallback(getInternalError('resource temporarily unavailable'));
} else if (err.code === noSuchFile) {
return unLockCallback(getNotFound());
} else {
return unLockCallback(err);
}
}
updateHandler(json, err => {
if (err) {
return unLockCallback(err);
}
onWrite(name, transformPackage(json), unLockCallback);
});
});
}
this.get((err, data) => {
if (err) {
cb(getInternalError('error remove private package'));
this.logger.error({ err }, '[local-storage/remove]: remove the private package has failed @{err}');
}
const pkgName = data.indexOf(name);
if (pkgName !== -1) {
this.data.list.splice(pkgName, 1);
this.logger.trace({ name }, 'local-storage: [remove] package @{name} has been removed');
}
cb(this._sync());
});
}