What is is-promise?
The is-promise npm package is a simple utility that checks if a given object is a promise. It is useful for ensuring that a value conforms to the Promise interface, which is essential in asynchronous programming.
Check if a value is a promise
This feature allows you to check if a given value is a promise. The function returns true if the value is a promise and false otherwise.
const isPromise = require('is-promise');
const promise = new Promise((resolve, reject) => {});
const notPromise = {};
console.log(isPromise(promise)); // true
console.log(isPromise(notPromise)); // false