nextable

0.0.2 • Public • Published

nextable

Build Status

Known Vulnerabilities

Computing any kinds of functions in serial order.

Install

npm install nextable

Usage

Require nextable

const nextable = require('nextable');

Functions of async and sync

 
// if not passing "next" to the arguments,
// will be treated like a normal function.
const normalTask = () => {
  console.log('normal task');
};
 
// if passing "next" to the arguments,
// will wait for "next" to be called
const setTimeoutTask = next => {
  setTimeout(() => {
    console.log('setTimeout Task');
    next();
  }, 1000);
};
 
const promiseTask = next =>
  new Promise(resolve => {
    console.log('promise Task');
    next();
    resolve();
  });
 

Passing any kind of functions:

nextable(
  setTimeoutTask,
  promiseTask,
  normalTask
);
 
// will logs
// -> setTimeout Task
// -> promise Task
// -> normal Task

Test

npm test

LICENSE

MIT

/nextable/

    Package Sidebar

    Install

    npm i nextable

    Weekly Downloads

    0

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    9.16 kB

    Total Files

    10

    Last publish

    Collaborators

    • addhome2001