You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

finally-aggregator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

finally-aggregator - npm Package Compare versions

Comparing version
1.2.0
to
1.2.1
+45
test.js
var FinallyAggregator = require('./');
var assert = require('assert');
var requested_attempts = 0;
var finished_attempts = 0;
function attempt(fns, expected_args, expected_state, after) {
requested_attempts++;
var acc = new FinallyAggregator();
var state = {};
fns.forEach(function (fn) {
acc.add(fn.bind(state));
});
acc.finish(function () {
finished_attempts++;
assert.equal(JSON.stringify(expected_args), JSON.stringify([].slice.call(arguments)))
assert.equal(JSON.stringify(expected_state), JSON.stringify(state));
if (typeof after === 'function') after();
});
return acc;
}
process.on('exit', function () {
assert.equal(requested_attempts, finished_attempts);
});
function makeStateFn(state) {
return function (next) {
for (var k in state) this[k] = state[k];
next();
}
}
function makeErrFn(err) {
return function (next) {
throw err;
next();
}
}
requested_attempts++;
var acc1 = attempt([], [null, []], {}, function after() {
acc1.add(function () {
finished_attempts++;
})
});
attempt([makeStateFn({x:1})], [null, []], {x:1});
attempt([makeErrFn({x:1})], [null, [{x:1}]], {});
+9
-2

@@ -25,3 +25,4 @@ function Cleanup() {

var errs = [];
if (this.todo) for (var i = 0; i < this.todo.length; i++) {
var i = 0;
if (this.todo) for (; i < this.todo.length; i++) {
setImmediate(function (action) {

@@ -45,7 +46,13 @@ var used = false;

i--;
check_done();
}
function check_done() {
if (i == 0 && typeof all_done === 'function') {
all_done(null, errs);
setImmediate(function () {
all_done(null, errs);
});
}
}
check_done();
this.todo = null;
}
+2
-2
{
"name": "finally-aggregator",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "node test.js"
},

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