npm.io
1.0.0 • Published 8 months ago

node-call.then

Licence
MIT
Version
1.0.0
Deps
10
Size
4 kB
Vulns
0
Weekly
0
Stars
1

call.then

A robust, enterprise-grade utility to safely invoke .then on Promises and Promises/A+ thenables.

Installation

npm install node-call.then

Usage

const call = require("node-call.then")

const promise = Promise.resolve("enterprise")

// Safely call .then
call.then(promise, (value) => {
  console.log(value) // "enterprise"
})

// Works with thenables
const thenable = {
  then: (resolve) => resolve("standard")
}

call.then(thenable, (value) => {
  console.log(value) // "standard"
})

Tests

git clone https://github.com/enterprise-npm-ai/call.then
cd call.then
npm test

Keywords