Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

serially

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serially - npm Package Compare versions

Comparing version
0.0.0
to
0.0.1-security
+13
-22
package.json
{
"name": "serially",
"version": "0.0.0",
"description": "Compose async functions into one function that runs all serially",
"version": "0.0.1-security",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha"
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"prova": "*"
},
"keywords": [
"serial",
"series",
"async",
"flow",
"flow control",
"serially"
],
"repository": {
"url": "git@github.com:azer/serially.git",
"type": "git"
"type": "git",
"url": "git+https://github.com/npm/security-holder.git"
},
"author": "azer",
"license": "BSD",
"dependencies": {
"serial-loop": "0.0.0"
}
}
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/npm/security-holder/issues"
},
"homepage": "https://github.com/npm/security-holder#readme"
}

@@ -1,36 +0,9 @@

## serially
# Security holding package
Compose async functions into one function that runs all serially
This package name is not currently in use, but was formerly occupied
by a popular package. To avoid malicious use, npm is hanging on to
the package name, but loosely, and we'll probably give it to you if
you want it.
## Install
```bash
$ npm install serially
```
## Usage
```js
var serially = require('serially')
var http = require('http')
var fs = require('fs')
var all = serially()
.add(foo, ['a', 'b', 'c'])
.add(bar, [1, 2, 3])
.add('qux alias', qux, [4, 5, 6])
all(function (error, results) {
if (error) throw error
console.log('done')
console.log(results)
// => { foo: [...], bar: [...], qux alias: [...] }
})
function foo (pa, ra, ms, callback) {}
function bar (pa, ra, ms, callback) {}
function qux (pa, ra, ms, callback) {}
```
See `test.js` for more info.
You may adopt this package by contacting support@npmjs.com and
requesting the name.

Sorry, the diff of this file is not supported yet

var loop = require("serial-loop");
module.exports = serially;
function serially (fn, params) {
var fns = [];
call.add = add;
return call;
function call (callback) {
var results = [];
loop(fns.length, each, function (error) {
callback(error, results);
});
function each (done, i) {
var params = fns[i].params ? fns[i].params.slice() : [];
params.push(function callback (error) {
if (error) return done(error);
results[fns[i].alias] = Array.prototype.slice.call(arguments, 1);
done();
});
fns[i].fn.apply(undefined, params);
}
}
function add (alias, fn, params) {
if (typeof alias != 'string') {
params = fn;
fn = alias;
alias = fn.name;
}
if (!alias) {
throw new Error('Function does not have a name. Either declare it with a name or specify an alias.');
}
fns.push({ alias: alias, fn: fn, params: params });
return call;
}
}