frontend/.pnpm-store/v3/files/f9/1d7f7479ba6138c70b12f2964ec7f3ef33ce522928d46cb718b5a6faf2cbb4227348d25081c532913c0c2a870011ae36a33e486974f0432adae8b3ba9c3fae

28 lines
641 B
Plaintext

# Thenable
_Thenable_ object (an object with `then` method)
## `thenable/is`
Confirms if given object is a _thenable_
```javascript
const isThenable = require("type/thenable/is");
isThenable(Promise.resolve()); // true
isThenable({ then: () => {} }); // true
isThenable({}); // false
```
## `thenable/ensure`
If given argument is a _thenable_ object, it is returned back. Otherwise `TypeError` is thrown.
```javascript
const ensureThenable = require("type/thenable/ensure");
const promise = Promise.resolve();
ensureThenable(promise); // promise
ensureThenable({}); // Thrown TypeError: [object Object] is not a thenable object
```