1 | # isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/isobject)
|
---|
2 |
|
---|
3 | > Returns true if the value is an object and not an array or null.
|
---|
4 |
|
---|
5 | ## Install
|
---|
6 |
|
---|
7 | Install with [npm](https://www.npmjs.com/):
|
---|
8 |
|
---|
9 | ```sh
|
---|
10 | $ npm install --save isobject
|
---|
11 | ```
|
---|
12 |
|
---|
13 | Install with [yarn](https://yarnpkg.com):
|
---|
14 |
|
---|
15 | ```sh
|
---|
16 | $ yarn add isobject
|
---|
17 | ```
|
---|
18 |
|
---|
19 | Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor.
|
---|
20 |
|
---|
21 | ## Install
|
---|
22 |
|
---|
23 | Install with [npm](https://www.npmjs.com/):
|
---|
24 |
|
---|
25 | ```sh
|
---|
26 | $ npm install isobject
|
---|
27 | ```
|
---|
28 | Install with [bower](https://bower.io/)
|
---|
29 |
|
---|
30 | ```sh
|
---|
31 | $ bower install isobject
|
---|
32 | ```
|
---|
33 |
|
---|
34 | ## Usage
|
---|
35 |
|
---|
36 | ```js
|
---|
37 | var isObject = require('isobject');
|
---|
38 | ```
|
---|
39 |
|
---|
40 | **True**
|
---|
41 |
|
---|
42 | All of the following return `true`:
|
---|
43 |
|
---|
44 | ```js
|
---|
45 | isObject({});
|
---|
46 | isObject(Object.create({}));
|
---|
47 | isObject(Object.create(Object.prototype));
|
---|
48 | isObject(Object.create(null));
|
---|
49 | isObject({});
|
---|
50 | isObject(new Foo);
|
---|
51 | isObject(/foo/);
|
---|
52 | ```
|
---|
53 |
|
---|
54 | **False**
|
---|
55 |
|
---|
56 | All of the following return `false`:
|
---|
57 |
|
---|
58 | ```js
|
---|
59 | isObject();
|
---|
60 | isObject(function () {});
|
---|
61 | isObject(1);
|
---|
62 | isObject([]);
|
---|
63 | isObject(undefined);
|
---|
64 | isObject(null);
|
---|
65 | ```
|
---|
66 |
|
---|
67 | ## About
|
---|
68 |
|
---|
69 | ### Related projects
|
---|
70 |
|
---|
71 | * [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.")
|
---|
72 | * [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.")
|
---|
73 | * [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.")
|
---|
74 | * [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.")
|
---|
75 |
|
---|
76 | ### Contributing
|
---|
77 |
|
---|
78 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
---|
79 |
|
---|
80 | ### Contributors
|
---|
81 |
|
---|
82 | | **Commits** | **Contributor** |
|
---|
83 | | --- | --- |
|
---|
84 | | 29 | [jonschlinkert](https://github.com/jonschlinkert) |
|
---|
85 | | 4 | [doowb](https://github.com/doowb) |
|
---|
86 | | 1 | [magnudae](https://github.com/magnudae) |
|
---|
87 | | 1 | [LeSuisse](https://github.com/LeSuisse) |
|
---|
88 | | 1 | [tmcw](https://github.com/tmcw) |
|
---|
89 |
|
---|
90 | ### Building docs
|
---|
91 |
|
---|
92 | _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
|
---|
93 |
|
---|
94 | To generate the readme, run the following command:
|
---|
95 |
|
---|
96 | ```sh
|
---|
97 | $ npm install -g verbose/verb#dev verb-generate-readme && verb
|
---|
98 | ```
|
---|
99 |
|
---|
100 | ### Running tests
|
---|
101 |
|
---|
102 | Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
|
---|
103 |
|
---|
104 | ```sh
|
---|
105 | $ npm install && npm test
|
---|
106 | ```
|
---|
107 |
|
---|
108 | ### Author
|
---|
109 |
|
---|
110 | **Jon Schlinkert**
|
---|
111 |
|
---|
112 | * [github/jonschlinkert](https://github.com/jonschlinkert)
|
---|
113 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
---|
114 |
|
---|
115 | ### License
|
---|
116 |
|
---|
117 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
---|
118 | Released under the [MIT License](LICENSE).
|
---|
119 |
|
---|
120 | ***
|
---|
121 |
|
---|
122 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 30, 2017._ |
---|