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