is
(* → {*}) → a → Boolean
Parameters
- ctorA constructor
- valThe value to test
Returns Boolean
Added in v0.3.0
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.
R.is(Object, {}); //=> trueR.is(Number, 1); //=> trueR.is(Object, 1); //=> falseR.is(String, 's'); //=> trueR.is(String, new String('')); //=> trueR.is(Object, new String('')); //=> trueR.is(Object, 's'); //=> falseR.is(Number, {}); //=> false
type
* → String
Parameters
- valThe value to test
Returns String
Added in v0.8.0
Gives a single-word string description of the (native) type of a value, returning such answers as ‘Object’, ‘Number’, ‘Array’, or ‘Null’. Does not attempt to distinguish user Object types any further, reporting them all as ‘Object’.
R.type({}); //=> "Object"R.type(1); //=> "Number"R.type(false); //=> "Boolean"R.type('s'); //=> "String"R.type(null); //=> "Null"R.type([]); //=> "Array"R.type(/[A-z]/); //=> "RegExp"R.type(() => {}); //=> "Function"R.type(async () => {}); //=> "AsyncFunction"R.type(undefined); //=> "Undefined"R.type(BigInt(123)); //=> "BigInt"
isNil
* → Boolean
Parameters
- xThe value to test.
Returns Boolean
trueifxisundefinedornull, otherwisefalse.
Added in v0.9.0
Checks if the input value is null or undefined.
R.isNil(null); //=> trueR.isNil(undefined); //=> trueR.isNil(0); //=> falseR.isNil([]); //=> false
