Socket
Book a DemoInstallSign in
Socket

thenable

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thenable

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

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

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

Keywords

promise

FAQs

Package last updated on 04 Mar 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts