promisefallback

1.0.0 • Public • Published

promisefallback

Receives an array of functions, values or promises and returns a promise that resolves with the first of them that resolves.

Installation

npm install promisefallback

Usage

import promiseFallback from 'promisefallback';
 
const promise = promiseFallback([
  Promise.reject('foo'),
  () => Promise.reject('bar'),
  () => Promise.resolve('baz')
]);
 
promise.then(value => assert(value === 'baz'));

Testing

Clone the repository and execute:

npm test

Contribute

  1. Fork it: git clone https://github.com/softonic/promisefallback.git
  2. Create your feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -am 'Added some feature'
  4. Check the build: npm run build
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :D

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    154
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    154

Package Sidebar

Install

npm i promisefallback

Weekly Downloads

65

Version

1.0.0

License

Apache-2.0

Last publish

Collaborators

  • softonic