[e29cc2e] | 1 | # is-extendable [![NPM version](https://badge.fury.io/js/is-extendable.svg)](http://badge.fury.io/js/is-extendable)
|
---|
[6a3a178] | 2 |
|
---|
[e29cc2e] | 3 | > 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?"
|
---|
[6a3a178] | 4 |
|
---|
| 5 | ## Install
|
---|
| 6 |
|
---|
[e29cc2e] | 7 | Install with [npm](https://www.npmjs.com/)
|
---|
[6a3a178] | 8 |
|
---|
| 9 | ```sh
|
---|
[e29cc2e] | 10 | $ npm i is-extendable --save
|
---|
[6a3a178] | 11 | ```
|
---|
| 12 |
|
---|
| 13 | ## Usage
|
---|
| 14 |
|
---|
| 15 | ```js
|
---|
| 16 | var isExtendable = require('is-extendable');
|
---|
| 17 | ```
|
---|
| 18 |
|
---|
| 19 | Returns true if the value is any of the following:
|
---|
| 20 |
|
---|
[e29cc2e] | 21 | * `array`
|
---|
| 22 | * `regexp`
|
---|
| 23 | * `plain object`
|
---|
| 24 | * `function`
|
---|
| 25 | * `date`
|
---|
| 26 | * `error`
|
---|
[6a3a178] | 27 |
|
---|
| 28 | ## Notes
|
---|
| 29 |
|
---|
| 30 | 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:
|
---|
| 31 |
|
---|
| 32 | * the value is not a primitive, or
|
---|
[e29cc2e] | 33 | * that the object is an `object`, `function`
|
---|
[6a3a178] | 34 |
|
---|
| 35 | 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`.
|
---|
| 36 |
|
---|
[e29cc2e] | 37 | ## Related projects
|
---|
[6a3a178] | 38 |
|
---|
[e29cc2e] | 39 | * [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object.
|
---|
| 40 | * [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util.
|
---|
| 41 | * [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null.
|
---|
| 42 | * [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor.
|
---|
| 43 | * [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.
|
---|
| 44 | * [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value.
|
---|
[6a3a178] | 45 |
|
---|
[e29cc2e] | 46 | ## Running tests
|
---|
[6a3a178] | 47 |
|
---|
[e29cc2e] | 48 | Install dev dependencies:
|
---|
[6a3a178] | 49 |
|
---|
| 50 | ```sh
|
---|
[e29cc2e] | 51 | $ npm i -d && npm test
|
---|
[6a3a178] | 52 | ```
|
---|
| 53 |
|
---|
[e29cc2e] | 54 | ## Contributing
|
---|
[6a3a178] | 55 |
|
---|
[e29cc2e] | 56 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-extendable/issues/new)
|
---|
[6a3a178] | 57 |
|
---|
[e29cc2e] | 58 | ## Author
|
---|
[6a3a178] | 59 |
|
---|
| 60 | **Jon Schlinkert**
|
---|
| 61 |
|
---|
[e29cc2e] | 62 | + [github/jonschlinkert](https://github.com/jonschlinkert)
|
---|
| 63 | + [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
---|
[6a3a178] | 64 |
|
---|
[e29cc2e] | 65 | ## License
|
---|
[6a3a178] | 66 |
|
---|
[e29cc2e] | 67 | Copyright © 2015 Jon Schlinkert
|
---|
| 68 | Released under the MIT license.
|
---|
[6a3a178] | 69 |
|
---|
| 70 | ***
|
---|
| 71 |
|
---|
[e29cc2e] | 72 | _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 04, 2015._ |
---|