@kingjs/is-object

1.0.1 • Public • Published

@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

Analytics

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/is-object

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.65 kB

Total Files

4

Last publish

Collaborators

  • kingces95