Skip to content

JoshuaWise/wise-inspection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wise-inspection Build Status

This package augments native promises (or a subclass thereof) with synchronous inspection capabilities.

This is only possible for Node.js versions 8 and up.

Installation

npm install --save wise-inspection

Usage

require('wise-inspection')(Promise);

const promise = Promise.resolve('foobar');
console.log(promise.inspect());
// => { state: 'fulfilled', value: 'foobar' }

The descriptor object

If the promise is:

  • fulfilled, the descriptor will be { state: 'fulfilled', value: <fulfillmentValue> }
  • rejected, the descriptor will be { state: 'rejected', reason: <rejectionReason> }
  • pending, the descriptor will be { state: 'pending' }

License

MIT