items-promise
Bare minimum async methods using promises
Last updated 3 years ago by pi0 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install items-promise 
SYNC missed versions from official npm registry.

items-promise

Bare minimum async methods using promises. (Inspired by items)

>_ yarn add items-promise

OR using NPM

>_ npm install items-promise
const { serial, parallel } = require('items-promise')

// OR

import { serial, parallel } from 'items-promise'

Usage

tasks should be always an array and fn should be a function witch returns a Promise object.

serial(tasks, fn)

Run tasks one by one by calling fn(task, previous) in a promise chain.

Return value is of type Promise<*> which resolves to the last fn result.

parallel(tasks, fn)

Run all tasks in parallel by calling fn(tasks) and await using Promise.all.

Return value is of type Promise<Array[*]> which resolves to results of all fns in an array.

License

Released under The MIT LICENSE

Copyright (c) 2017 Pooya Parsa

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)

Copyright 2014 - 2017 © taobao.org |