Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
store.close = function close(returnError) {
jsonpatch.unobserve(store.data, observer);
lockFile.unlock(storePath + LOCK_FILE_EXTENSION, function (error) {
if (error) {
error.stacktrace = new Error().stack;
store.emit('error', error);
if (returnError) { returnError(error); } else { throw error; }
return;
}
store.emit('closed');
returnError && returnError();
});
};
unobserve() {
if(!this.observer) {
throw new Error('Not observing changes');
}
jsonpatch.unobserve(this.doc, this.observer);
this.observer = null;
}
store.close = function close(returnError) {
jsonpatch.unobserve(store.data, observer);
lockFile.unlock(path + LOCK_FILE_EXTENSION, function (error) {
if (error) {
if (returnError) { returnError(error); } else { throw error; }
return;
}
returnError && returnError();
});
};