New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

castor-load

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

castor-load - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

157

lib/mount.js

@@ -0,13 +1,15 @@

/*jshint node:true, laxcomma:true*/
'use strict';
var path = require('path')
, basename = path.basename(__filename, '.js')
, debug = require('debug')('castor:load:' + basename)
, util = require('util')
, crypto = require('crypto')
, assert = require('assert')
, async = require('async')
var debug = require('debug')('castor:load:' + basename)
, path = require('path')
, basename = path.basename(__filename, '.js')
, util = require('util')
, crypto = require('crypto')
, assert = require('assert')
, async = require('async')
, minimatch = require('minimatch')
, clone = require('clone')
, File = require('./file.js')
, clone = require('clone')
, shorthash = require('shorthash')
, File = require('./file.js')
;

@@ -32,5 +34,5 @@

var worker = function (doc, done) {
var h = [function(callback){ callback(null, doc) }];
var h = [function(callback){ callback(null, doc); }];
async.waterfall(h.concat(self.handlers), function(err, d) {
if (err == null && d == null) {
if (err === null && d === null) {
debug('The waterfall is deliberately broken');

@@ -40,3 +42,3 @@ }

});
}
};

@@ -62,12 +64,12 @@ self.queue = async.queue(worker, self.options.concurrency);

var mark = function(o) {
if (o['mountBy'] === undefined) {
o['mountBy'] = [fnid];
if (o.mountBy === undefined) {
o.mountBy = [fnid];
}
o['mountBy'].push(fnid);
o.mountBy.push(fnid);
return o;
}
};
self.handlers.push(function(iDoc, next) {
debug('through', fnid);
if (iDoc == null) {
if (!iDoc) {
return next();

@@ -79,3 +81,3 @@ }

}
if (iDoc['mountBy'] && iDoc['mountBy'].indexOf(fnid) >= 0) {
if (iDoc.mountBy && iDoc.mountBy.indexOf(fnid) >= 0) {
debug(fnid + ' ignored', iDoc.filename);

@@ -90,3 +92,3 @@ return next(null, iDoc);

, wrk = function (arg1, callback) {
self.appendDoc(arg1, arg1.memorizeWorkerForSubdoc, callback)
self.appendDoc(arg1, arg1.memorizeWorkerForSubdoc, callback);
}

@@ -104,3 +106,3 @@ , qe = async.queue(wrk, 1)

}
else if (arg1 == null && arg2 !== null) {
else if (!arg1 && arg2) {
debug(fnid + ' mounted', iDoc.filename);

@@ -111,3 +113,3 @@ if (numb === 1) {

}
else if (arg1 == null && arg2 == null) {
else if (!arg1 && !arg2) {
// last call

@@ -123,4 +125,4 @@ }

debug('finalize', fnid, numb, nump, qe.length());
}
}
};
};
next(se);

@@ -130,2 +132,3 @@ }

arg1.filename = arg1.filename + '[' + numb + ']';
arg1.wid = shorthash.unique(arg1.fid);
// sub Document

@@ -153,67 +156,67 @@ debug('explode', arg1.fid, arg1.filename);

});
}
};
Mount.prototype.append = function (file, worker, done) {
Mount.prototype.append = function (file, worker, done) {
assert(file instanceof File);
var self = this;
file.analyze(function(err, doc) {
if (err) {
assert(file instanceof File);
var self = this;
file.analyze(function(err, doc) {
if (err) {
done(err);
}
self.appendDoc(doc, worker, function(err) {
if (err && err.wait) {
err.wait(done);
}
else {
done(err);
}
self.appendDoc(doc, worker, function(err) {
if (err && err.wait) {
err.wait(done);
}
else {
done(err);
}
});
});
}
});
};
Mount.prototype.appendDoc = function (doc, worker, done) {
debug('mount', doc.filename);
var self = this;
doc.memorizeWorkerForSubdoc = worker;
self.queue.push(doc, function(err, dta) {
debug('mounted', doc.filename);
if (err) {
Mount.prototype.appendDoc = function (doc, worker, done) {
debug('mount', doc.filename);
var self = this;
doc.memorizeWorkerForSubdoc = worker;
self.queue.push(doc, function(err, dta) {
debug('mounted', doc.filename);
if (err) {
return done(err);
}
if (Array.isArray(dta)) {
async.mapLimit(dta, self.options.concurrency, function iterator(item, callback) {
self.appendIDoc(item, function(err, idoc) {
worker(idoc, callback);
});
}, function(err, res) {
done(err);
});
}
else if (!dta) {
done(new Error('The document was drained'));
}
else {
worker(dta, function(err) {
return done(err);
}
if (Array.isArray(dta)) {
async.mapLimit(dta, self.options.concurrency, function iterator(item, callback) {
self.appendIDoc(item, function(err, idoc) {
worker(idoc, callback);
});
}, function(err, res) {
done(err);
});
}
else if (dta == null) {
done(new Error('The document was drained'));
}
else {
worker(dta, function(err) {
return done(err);
});
}
});
}
});
}
});
};
Mount.prototype.appendIDoc = function (doc, next) {
var self = this;
self.queue.push(doc, function(err, dta) {
if (err) {
return next(err, dta);
}
else {
next(null, dta);
Mount.prototype.appendIDoc = function (doc, next) {
var self = this;
self.queue.push(doc, function(err, dta) {
if (err) {
return next(err, dta);
}
else {
next(null, dta);
}
});
}
}
});
};
module.exports = Mount;
module.exports = Mount;

@@ -365,2 +365,3 @@ 'use strict';

}
if (logicalSHA1 && logicalSHA1 !== physicalSHA1) {

@@ -375,3 +376,3 @@ debug('updated', physical.filename);

var newdoc = {};
extend(true, newdoc, logical, physical);
extend(newdoc, logical, physical);
self.update(logical.fid, newdoc, next);

@@ -378,0 +379,0 @@ }

{
"name": "castor-load",
"version": "1.1.1",
"version": "1.2.0",
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",

@@ -22,15 +22,16 @@ "contributors": [],

"dependencies": {
"async": "~0.2.10",
"bytes": "^1.0.0",
"chokidar": "^0.8.2",
"clone": "^0.1.17",
"debug": "^0.7.4",
"extend": "~1.2.1",
"findit": "~1.1.0",
"js-yaml": "~3.0.1",
"minimatch": "~0.2.14",
"mkdirp": "~0.3.5",
"debug": "^0.7.4",
"findit": "~1.1.0",
"tingodb": "~0.2.1",
"async": "~0.2.10",
"extend": "~1.2.1",
"mongodb": "^1.4.10",
"once": "~1.3.0",
"mongodb": "^1.4.10",
"js-yaml": "~3.0.1",
"chokidar": "^0.8.2",
"clone": "^0.1.17",
"bytes": "^1.0.0"
"shorthash": "0.0.2",
"tingodb": "~0.2.1"
},

@@ -37,0 +38,0 @@ "devDependencies": {

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