Icard/angular-clarity-master(work.../node_modules/ramda/es/is.js

33 lines
999 B
JavaScript

import _curry2 from "./internal/_curry2.js";
/**
* See if an object (i.e. `val`) is an instance of the supplied constructor. This
* function will check up the inheritance chain, if any.
* If `val` was created using `Object.create`, `R.is(Object, val) === true`.
*
* @func
* @memberOf R
* @since v0.3.0
* @category Type
* @sig (* -> {*}) -> a -> Boolean
* @param {Object} ctor A constructor
* @param {*} val The value to test
* @return {Boolean}
* @example
*
* R.is(Object, {}); //=> true
* R.is(Number, 1); //=> true
* R.is(Object, 1); //=> false
* R.is(String, 's'); //=> true
* R.is(String, new String('')); //=> true
* R.is(Object, new String('')); //=> true
* R.is(Object, 's'); //=> false
* R.is(Number, {}); //=> false
*/
var is =
/*#__PURE__*/
_curry2(function is(Ctor, val) {
return val instanceof Ctor || val != null && (val.constructor === Ctor || Ctor.name === 'Object' && typeof val === 'object');
});
export default is;