@kingjs/is-object
v1.0.1
Published
Returns true if the `typeof` a value is `'object'` and is not `null`
Downloads
1
Readme
@kingjs/is-object
Returns true if the typeof
a value is 'object'
and is not null
.
Usage
Test if undefined
, 10
, null
, 'Hi!'
, function() { }
, []
, { }
are objects like this:
var isObject = require('@kingjs/is-object');
{
undef: isObject(),
nll: isObject(null),
number: isObject(10),
string: isObject('Hi!'),
func: isObject(function() { }),
array: isObject([ ]),
literal: isObject({ }),
}
result:
{
undef: false,
nll: false,
number: false,
string: false,
func: false,
array: true,
literal: true,
}
API
declare function isObject(
value: any
): boolean
Parameters
value
: The value to test.
Returns
Returns true if the type of the value is object and the value is not null.
Install
With npm installed, run
$ npm install @kingjs/is-object
License
MIT