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 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # is-extendable [![NPM version](https://badge.fury.io/js/is-extendable.svg)](http://badge.fury.io/js/is-extendable)
  2. > Returns true if a value is any of the object types: array, regexp, plain object, function or date. This is useful for determining if a value can be extended, e.g. "can the value have keys?"
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/)
  5. ```sh
  6. $ npm i is-extendable --save
  7. ```
  8. ## Usage
  9. ```js
  10. var isExtendable = require('is-extendable');
  11. ```
  12. Returns true if the value is any of the following:
  13. * `array`
  14. * `regexp`
  15. * `plain object`
  16. * `function`
  17. * `date`
  18. * `error`
  19. ## Notes
  20. All objects in JavaScript can have keys, but it's a pain to check for this, since we ether need to verify that the value is not `null` or `undefined` and:
  21. * the value is not a primitive, or
  22. * that the object is an `object`, `function`
  23. Also note that an `extendable` object is not the same as an [extensible object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible), which is one that (in es6) is not sealed, frozen, or marked as non-extensible using `preventExtensions`.
  24. ## Related projects
  25. * [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object.
  26. * [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util.
  27. * [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null.
  28. * [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
  29. * [is-equal-shallow](https://github.com/jonschlinkert/is-equal-shallow): Does a shallow comparison of two objects, returning false if the keys or values differ.
  30. * [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value.
  31. ## Running tests
  32. Install dev dependencies:
  33. ```sh
  34. $ npm i -d && npm test
  35. ```
  36. ## Contributing
  37. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-extendable/issues/new)
  38. ## Author
  39. **Jon Schlinkert**
  40. + [github/jonschlinkert](https://github.com/jonschlinkert)
  41. + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
  42. ## License
  43. Copyright © 2015 Jon Schlinkert
  44. Released under the MIT license.
  45. ***
  46. _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 04, 2015._