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

chainz

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chainz - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.babelrc

25

index.js

@@ -1,26 +0,25 @@

var ChainGang = function (gang) {
var next = function () {
const chainz = (...gangs) => {
let gang = [];
const next = function (...args) {
if(gang.length > 0) {
gang.shift()();
gang.shift()(...args);
}
};
function Chain (func) {
const Chain = func => {
if(typeof func !== 'function') {
console.warn('every element in array, must be a function');
console.warn('every argument must be a function');
func = next;
}
return function () {
var args = Array.prototype.slice.call(arguments);
return function (...args) {
args.push(next);
func.apply(null, args);
// run next event loop
setTimeout(func.bind(Object.create(null), ...args), 0);
};
}
};
var gang = gang.map(Chain);
gang = gangs.map(Chain);
next();
};
module.exports = ChainGang;
module.exports = chainz;
{
"name": "chainz",
"version": "1.0.0",
"version": "1.0.1",
"description": "Helps call an array of async functions in order, by injecting a next callback ",
"repository": {
"type": "git",
"url": "https://github.com/turbobeast/chainz.git"
},
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "babel-node test/index.js | faucet"
},

@@ -14,3 +18,8 @@ "keywords": [

"author": "George Michael Faust <georgemichaelfaust@gmail.com> (http://georgemichaelfaust.com/)",
"license": "MIT"
"license": "MIT",
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"faucet": "0.0.1",
"tape": "^4.4.0"
}
}
## Chainz
[![Build Status](https://travis-ci.org/turbobeast/chainz.svg)](https://travis-ci.org/turbobeast/chainz)
Helps call an array of async functions in order, by injecting a next callback.
```javascript
var chain = require('chainz');
var ayncFunctionOne (next) {
//do something asnyc
next(); // calls asyncFunctionTwo
const asyncFunctionOne = next => {
// do something asnyc
next('cheese'); // calls asyncFunctionTwo
};
var asyncFunctionTwo (next) {
//do something asnyc
next(); //calls asyncFunctionThree
const asyncFunctionTwo = (message, next) => {
// do something asnyc
console.log(message); // cheese
next('peanut butter'); // calls asyncFunctionThree
};
var asyncFunctionThree () {
//done
const asyncFunctionThree = message => {
// done
console.log(message); // peanut butter
};
chain([asyncFunctionOne, asyncFunctionTwo, asyncFunctionThree]);
chain(asyncFunctionOne, asyncFunctionTwo, asyncFunctionThree);
```
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