mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 22:22:34 +03:00
bbaf619f63
swc_bundler: - [x] Fix wrapped esms. (denoland/deno#9307) - [x] Make test secure.
34 lines
913 B
TypeScript
34 lines
913 B
TypeScript
// Loaded from https://deno.land/x/ramda@v0.27.2/source/is.js
|
|
|
|
|
|
import _curry2 from './internal/_curry2.js';
|
|
|
|
|
|
/**
|
|
* See if an object (`val`) is an instance of the supplied constructor. This
|
|
* function will check up the inheritance chain, if any.
|
|
*
|
|
* @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 = _curry2(function is(Ctor, val) {
|
|
return val != null && val.constructor === Ctor || val instanceof Ctor;
|
|
});
|
|
export default is;
|