UNPKG

moltres-utils

Version:
42 lines (36 loc) 1.28 kB
"use strict"; require("core-js/modules/es6.object.define-property"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _curry = _interopRequireDefault(require("../common/curry")); var _dispatchable = _interopRequireDefault(require("../common/dispatchable")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * See if an object (`val`) is an instance of the supplied constructor. This function will check up the inheritance chain, if any. * * @function * @since v0.0.3 * @category data * @sig (* -> {*}) -> a -> boolean * @param {Object} constructor A constructor * @param {*} value The value to test * @returns {boolean} * @example * * is(Object, {}); //=> true * is(Number, 1); //=> true * is(Object, 1); //=> false * is(String, 's'); //=> true * is(String, new String('')); //=> true * is(Object, new String('')); //=> true * is(Object, 's'); //=> false * is(Number, {}); //=> false */ var is = (0, _curry.default)((0, _dispatchable.default)('is', function (construtor, value) { return value != null && value.constructor === construtor || value instanceof construtor; })); var _default = is; exports.default = _default; //# sourceMappingURL=is.js.map