isPrimitive
Test if a value is a JavaScript primitive.
isPrimitive(obj)
Return true
if obj
is not a function nor an object via typeof
, or is null; false
otherwise.
canReflect.isPrimitive(null); // -> true
canReflect.isPrimitive({}); // -> false
canReflect.isPrimitive(undefined); // -> true
canReflect.isPrimitive(1); // -> true
canReflect.isPrimitive([]); // -> false
canReflect.isPrimitive(function() {}); // -> false
canReflect.isPrimitive("foo"); // -> true
Parameters
- obj
{*}
:maybe a primitive value
Returns
{Boolean}
: