5c9112661dd3319ff9e12c66576b6fbce96ff6d5121a77d82e86eef77f12669cd6c29f8c6975afd3f9e447fe4daf681f2cb4c12d5b2b6ba0b0f93bcd031abe 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat)](https://travis-ci.org/jonschlinkert/isobject)
  2. Returns true if the value is an object and not an array or null.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install isobject --save
  7. ```
  8. Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor.
  9. ## Install
  10. Install with [npm](https://www.npmjs.com/):
  11. ```sh
  12. $ npm install isobject
  13. ```
  14. Install with [bower](http://bower.io/)
  15. ```sh
  16. $ bower install isobject
  17. ```
  18. ## Usage
  19. ```js
  20. var isObject = require('isobject');
  21. ```
  22. **True**
  23. All of the following return `true`:
  24. ```js
  25. isObject({});
  26. isObject(Object.create({}));
  27. isObject(Object.create(Object.prototype));
  28. isObject(Object.create(null));
  29. isObject({});
  30. isObject(new Foo);
  31. isObject(/foo/);
  32. ```
  33. **False**
  34. All of the following return `false`:
  35. ```js
  36. isObject();
  37. isObject(function () {});
  38. isObject(1);
  39. isObject([]);
  40. isObject(undefined);
  41. isObject(null);
  42. ```
  43. ## Related projects
  44. You might also be interested in these projects:
  45. [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep)
  46. * [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)
  47. * [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)
  48. * [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of)
  49. ## Contributing
  50. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/isobject/issues/new).
  51. ## Building docs
  52. Generate readme and API documentation with [verb](https://github.com/verbose/verb):
  53. ```sh
  54. $ npm install verb && npm run docs
  55. ```
  56. Or, if [verb](https://github.com/verbose/verb) is installed globally:
  57. ```sh
  58. $ verb
  59. ```
  60. ## Running tests
  61. Install dev dependencies:
  62. ```sh
  63. $ npm install -d && npm test
  64. ```
  65. ## Author
  66. **Jon Schlinkert**
  67. * [github/jonschlinkert](https://github.com/jonschlinkert)
  68. * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  69. ## License
  70. Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
  71. Released under the [MIT license](https://github.com/jonschlinkert/isobject/blob/master/LICENSE).
  72. ***
  73. _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 25, 2016._