source: node_modules/ramda-adjunct/es/isThenable.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 791 bytes
Line 
1import { pathSatisfies } from 'ramda';
2import isFunction from './isFunction';
3
4/**
5 * Checks if input value is a `thenable`.
6 * `thenable` is an object or function that defines a `then` method.
7 *
8 * @func isThenable
9 * @memberOf RA
10 * @since {@link https://char0n.github.io/ramda-adjunct/2.1.0|v2.1.0}
11 * @category Type
12 * @sig * -> Boolean
13 * @param {*} val The value to test
14 * @return {boolean}
15 * @see {@link RA.isPromise|isPromise}
16 * @example
17 *
18 * RA.isThenable(null); // => false
19 * RA.isThenable(undefined); // => false
20 * RA.isThenable([]); // => false
21 * RA.isThenable(Promise.resolve()); // => true
22 * RA.isThenable(Promise.reject()); // => true
23 * RA.isThenable({ then: () => 1 }); // => true
24 */
25var isThenable = pathSatisfies(isFunction, ['then']);
26export default isThenable;
Note: See TracBrowser for help on using the repository browser.