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:
1019 bytes
|
Line | |
---|
1 | var _curry2 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./internal/_curry2.js");
|
---|
4 | /**
|
---|
5 | * See if an object (i.e. `val`) is an instance of the supplied constructor. This
|
---|
6 | * function will check up the inheritance chain, if any.
|
---|
7 | * If `val` was created using `Object.create`, `R.is(Object, val) === true`.
|
---|
8 | *
|
---|
9 | * @func
|
---|
10 | * @memberOf R
|
---|
11 | * @since v0.3.0
|
---|
12 | * @category Type
|
---|
13 | * @sig (* -> {*}) -> a -> Boolean
|
---|
14 | * @param {Object} ctor A constructor
|
---|
15 | * @param {*} val The value to test
|
---|
16 | * @return {Boolean}
|
---|
17 | * @example
|
---|
18 | *
|
---|
19 | * R.is(Object, {}); //=> true
|
---|
20 | * R.is(Number, 1); //=> true
|
---|
21 | * R.is(Object, 1); //=> false
|
---|
22 | * R.is(String, 's'); //=> true
|
---|
23 | * R.is(String, new String('')); //=> true
|
---|
24 | * R.is(Object, new String('')); //=> true
|
---|
25 | * R.is(Object, 's'); //=> false
|
---|
26 | * R.is(Number, {}); //=> false
|
---|
27 | */
|
---|
28 |
|
---|
29 |
|
---|
30 | var is =
|
---|
31 | /*#__PURE__*/
|
---|
32 | _curry2(function is(Ctor, val) {
|
---|
33 | return val instanceof Ctor || val != null && (val.constructor === Ctor || Ctor.name === 'Object' && typeof val === 'object');
|
---|
34 | });
|
---|
35 |
|
---|
36 | module.exports = is; |
---|
Note:
See
TracBrowser
for help on using the repository browser.