A reimplementation of Node's util.getPromiseDetails()
, which was removed in v16.
Note
This package is not recommended for use in production other than for reflection purposes. For more information about this topic, please see nodejs/node#40054.
npm i inspect-promise
There are two ways you can use this package:
- Import normally as a function
import { inspectPromise } from "inspect-promise";
const p = Promise.resolve(100);
console.log(inspectPromise(p));
- Globally modify the Promise constructor
import "inspect-promise/extend";
const p = Promise.resolve(100);
console.log(Promise.inspect(p));
Both result in the same output:
{
status: "fulfilled",
value: 100
}