Socket
Socket
Sign inDemoInstall

jfs

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jfs - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

128

lib/Store.js

@@ -1,5 +0,5 @@

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.1
/*
Copyright (C) 2012 - 2014 Markus Kohlhase <mail@markus-kohlhase.de>
Copyright (C) 2012 - 2015 Markus Kohlhase <mail@markus-kohlhase.de>
*/

@@ -86,3 +86,2 @@

e = _error;
console.error(e);
return e;

@@ -95,3 +94,3 @@ }

var e;
if (err != null) {
if (err) {
return cb(err);

@@ -103,3 +102,2 @@ }

e = _error;
console.error(e);
return cb(e);

@@ -149,3 +147,3 @@ }

id2fileName = function(id, dir) {
return path.join(dir, "" + id + ".json");
return path.join(dir, id + ".json");
};

@@ -175,3 +173,3 @@

return function(err) {
if (err != null) {
if (err) {
if (_this._single) {

@@ -242,68 +240,50 @@ _this._cache[id] = backup;

return done(null, o);
} else {
if (cb != null) {
return getObjectFromFile.call(this, id, done);
} else {
err = (o = getObjectFromFileSync.call(this, id)) instanceof Error;
return done(err, o);
}
}
if (cb != null) {
return getObjectFromFile.call(this, id, done);
}
err = (o = getObjectFromFileSync.call(this, id)) instanceof Error;
return done((err ? o : void 0), (!err ? o : void 0));
};
remove = function(id, cb) {
var backup, done, e, err, file, o;
var cacheBackup, done, e, err, file, notInCache, o;
file = this._getFileName(id);
cacheBackup = this._cache[id];
if (cacheBackup == null) {
notInCache = new Error(id + " does not exist");
}
done = (function(_this) {
return function(err) {
if (err) {
_this._cache[id] = cacheBackup;
return (cb != null ? cb(err) : err);
}
delete _this._cache[id];
return typeof cb === "function" ? cb() : void 0;
};
})(this);
if (this._single) {
backup = this._cache[id];
delete this._cache[id];
done = (function(_this) {
return function(err) {
if (err != null) {
_this._cache[id] = backup;
if (cb != null) {
return cb(err);
} else {
return err;
}
} else {
return typeof cb === "function" ? cb(null) : void 0;
}
};
})(this);
if (this._memory) {
return done();
} else {
if (cb != null) {
return saveObjectToFile.call(this, this._cache, file, done);
} else {
err = (o = saveObjectToFile.call(this, this._cache, file)) instanceof Error;
return done(err, o);
}
if (this._memory || (notInCache != null)) {
return done(notInCache);
}
if (cb != null) {
return saveObjectToFile.call(this, this._cache, file, done);
}
err = (o = saveObjectToFile.call(this, this._cache, file)) instanceof Error;
return done((err ? o : void 0), (!err ? o : void 0));
} else {
done = (function(_this) {
return function(err) {
if (err != null) {
return (cb != null ? cb(err) : err);
}
delete _this._cache[id];
if (cb != null) {
return cb(null);
}
};
})(this);
if (this._memory) {
return done();
} else {
if (cb != null) {
return fs.unlink(file, done);
} else {
try {
return done(fs.unlinkSync(file));
} catch (_error) {
e = _error;
return done(e);
}
}
return done(notInCache);
}
if (cb != null) {
return fs.unlink(file, done);
}
try {
return done(fs.unlinkSync(file));
} catch (_error) {
e = _error;
return done(e);
}
}

@@ -398,3 +378,3 @@ };

var all, id, loaders, that;
if (err != null) {
if (typeof er !== "undefined" && er !== null) {
return cb(err);

@@ -405,10 +385,10 @@ }

loaders = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = ids.length; _i < _len; _i++) {
id = ids[_i];
_results.push((function(id) {
var i, len, results;
results = [];
for (i = 0, len = ids.length; i < len; i++) {
id = ids[i];
results.push((function(id) {
return function(cb) {
return that.get(id, function(err, o) {
if (err == null) {
if (!err) {
all[id] = o;

@@ -421,3 +401,3 @@ }

}
return _results;
return results;
})();

@@ -433,3 +413,3 @@ return async.parallel(loaders, function(err) {

Store.prototype.allSync = function() {
var db, f, item, objects, _i, _len, _ref;
var db, f, i, item, len, objects, ref;
if (this._memory) {

@@ -446,5 +426,5 @@ return this._cache;

objects = {};
_ref = readIDsSync(this._dir);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
f = _ref[_i];
ref = readIDsSync(this._dir);
for (i = 0, len = ref.length; i < len; i++) {
f = ref[i];
item = getObjectFromFileSync.call(this, f);

@@ -451,0 +431,0 @@ if (item != null) {

{
"name": "jfs",
"version": "0.2.5",
"version": "0.2.6",
"main": "./lib/Store",

@@ -14,14 +14,14 @@ "description": "A simple JSON file store",

"dependencies": {
"mkdirp": "~0.5.0",
"node-uuid": "~1.4.2",
"async": "~0.9.0",
"clone": "~0.2.0"
"mkdirp": "~0.5.1",
"node-uuid": "~1.4.3",
"async": "~1.2.1",
"clone": "~1.0.2"
},
"devDependencies": {
"chai": "~1.10.0",
"coffee-script": "~1.8.0",
"coffeelint": "~1.8.1",
"chai": "~3.0.0",
"coffee-script": "~1.9.3",
"coffeelint": "~1.10.1",
"coveralls": "~2.11.2",
"istanbul": "~0.3.5",
"mocha": "~2.1.0"
"istanbul": "~0.3.14",
"mocha": "~2.2.5"
},

@@ -28,0 +28,0 @@ "repository": {

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