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.

  1. R.is(Object, {}); //=> true
  2. R.is(Number, 1); //=> true
  3. R.is(Object, 1); //=> false
  4. R.is(String, 's'); //=> true
  5. R.is(String, new String('')); //=> true
  6. R.is(Object, new String('')); //=> true
  7. R.is(Object, 's'); //=> false
  8. R.is(Number, {}); //=> false