Skip to content

unjs-archive/items-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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<*[]> which resolves to results of all fns in an array.

License

Released under The MIT LICENSE

Copyright (c) 2017 Pooya Parsa

About

Bare minimum async methods using promises

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published