ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
35 lines (30 loc) • 1.04 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
var _isFunction = _interopRequireDefault(require("./isFunction"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Checks if input value is a `thenable`.
* `thenable` is an object or function that defines a `then` method.
*
* @func isThenable
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/2.1.0|v2.1.0}
* @category Type
* @sig * -> Boolean
* @param {*} val The value to test
* @return {boolean}
* @see {@link RA.isPromise|isPromise}
* @example
*
* RA.isThenable(null); // => false
* RA.isThenable(undefined); // => false
* RA.isThenable([]); // => false
* RA.isThenable(Promise.resolve()); // => true
* RA.isThenable(Promise.reject()); // => true
* RA.isThenable({ then: () => 1 }); // => true
*/
var isThenable = (0, _ramda.pathSatisfies)(_isFunction["default"], ['then']);
var _default = isThenable;
exports["default"] = _default;
;