You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # is-plain-object [![NPM version](https://img.shields.io/npm/v/is-plain-object.svg?style=flat)](https://www.npmjs.com/package/is-plain-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![NPM total downloads](https://img.shields.io/npm/dt/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-plain-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-plain-object)
  2. > Returns true if an object was created by the `Object` constructor.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save is-plain-object
  7. ```
  8. Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null.
  9. ## Usage
  10. ```js
  11. var isPlainObject = require('is-plain-object');
  12. ```
  13. **true** when created by the `Object` constructor.
  14. ```js
  15. isPlainObject(Object.create({}));
  16. //=> true
  17. isPlainObject(Object.create(Object.prototype));
  18. //=> true
  19. isPlainObject({foo: 'bar'});
  20. //=> true
  21. isPlainObject({});
  22. //=> true
  23. ```
  24. **false** when not created by the `Object` constructor.
  25. ```js
  26. isPlainObject(1);
  27. //=> false
  28. isPlainObject(['foo', 'bar']);
  29. //=> false
  30. isPlainObject([]);
  31. //=> false
  32. isPlainObject(new Foo);
  33. //=> false
  34. isPlainObject(null);
  35. //=> false
  36. isPlainObject(Object.create(null));
  37. //=> false
  38. ```
  39. ## About
  40. ### Related projects
  41. * [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.")
  42. * [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.")
  43. * [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.")
  44. ### Contributing
  45. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  46. ### Contributors
  47. | **Commits** | **Contributor** |
  48. | --- | --- |
  49. | 17 | [jonschlinkert](https://github.com/jonschlinkert) |
  50. | 6 | [stevenvachon](https://github.com/stevenvachon) |
  51. | 3 | [onokumus](https://github.com/onokumus) |
  52. | 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
  53. ### Building docs
  54. _(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.)_
  55. To generate the readme, run the following command:
  56. ```sh
  57. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  58. ```
  59. ### Running tests
  60. 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:
  61. ```sh
  62. $ npm install && npm test
  63. ```
  64. ### Author
  65. **Jon Schlinkert**
  66. * [github/jonschlinkert](https://github.com/jonschlinkert)
  67. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  68. ### License
  69. Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
  70. Released under the [MIT License](LICENSE).
  71. ***
  72. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2017._