Skip to content

beolozne/thenable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thenable

Build Status Dependency Status

Wrap and unwrap thenables so that you can pass them through promises

Installation

$ npm install thenable

API

thenable.wrap(thenable)

Return a Wrapped object for that thenable

thenable.unwrap(obj)

If obj is a Wrapped return the thenable that obj wraps, else return obj.

Wrapped#unwrap()

Return the thenable being wrapped.

Example

promise
  .then(function () {
    return thenable.wrap(A);
  })
  .then(function (a) {
    assert(thenable.unwrap(a) === A);
    assert(a.unwrap() === A);
    return 'foo';
  })
  .then(function (foo) {
    assert(thenable.unwrap(foo) === 'foo');
  });

License

MIT

viewcount

About

Wrap and unwrap thenables so that you can pass them through promises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%