1 | # is-extendable [![NPM version](https://img.shields.io/npm/v/is-extendable.svg?style=flat)](https://www.npmjs.com/package/is-extendable) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-extendable.svg?style=flat)](https://npmjs.org/package/is-extendable) [![NPM total downloads](https://img.shields.io/npm/dt/is-extendable.svg?style=flat)](https://npmjs.org/package/is-extendable) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-extendable.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-extendable)
|
---|
2 |
|
---|
3 | > Returns true if a value is a plain object, array or function.
|
---|
4 |
|
---|
5 | ## Install
|
---|
6 |
|
---|
7 | Install with [npm](https://www.npmjs.com/):
|
---|
8 |
|
---|
9 | ```sh
|
---|
10 | $ npm install --save is-extendable
|
---|
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 |
|
---|
21 | * array
|
---|
22 | * plain object
|
---|
23 | * function
|
---|
24 |
|
---|
25 | ## Notes
|
---|
26 |
|
---|
27 | 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:
|
---|
28 |
|
---|
29 | * the value is not a primitive, or
|
---|
30 | * that the object is a plain object, function or array
|
---|
31 |
|
---|
32 | 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`.
|
---|
33 |
|
---|
34 | ## Release history
|
---|
35 |
|
---|
36 | ### v1.0.0 - 2017/07/20
|
---|
37 |
|
---|
38 | **Breaking changes**
|
---|
39 |
|
---|
40 | * No longer considers date, regex or error objects to be extendable
|
---|
41 |
|
---|
42 | ## About
|
---|
43 |
|
---|
44 | ### Related projects
|
---|
45 |
|
---|
46 | * [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target (first) object.")
|
---|
47 | * [is-equal-shallow](https://www.npmjs.com/package/is-equal-shallow): Does a shallow comparison of two objects, returning false if the keys or values differ. | [homepage](https://github.com/jonschlinkert/is-equal-shallow "Does a shallow comparison of two objects, returning false if the keys or values differ.")
|
---|
48 | * [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.")
|
---|
49 | * [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.")
|
---|
50 | * [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.")
|
---|
51 |
|
---|
52 | ### Contributing
|
---|
53 |
|
---|
54 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
---|
55 |
|
---|
56 | ### Building docs
|
---|
57 |
|
---|
58 | _(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.)_
|
---|
59 |
|
---|
60 | To generate the readme, run the following command:
|
---|
61 |
|
---|
62 | ```sh
|
---|
63 | $ npm install -g verbose/verb#dev verb-generate-readme && verb
|
---|
64 | ```
|
---|
65 |
|
---|
66 | ### Running tests
|
---|
67 |
|
---|
68 | 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:
|
---|
69 |
|
---|
70 | ```sh
|
---|
71 | $ npm install && npm test
|
---|
72 | ```
|
---|
73 |
|
---|
74 | ### Author
|
---|
75 |
|
---|
76 | **Jon Schlinkert**
|
---|
77 |
|
---|
78 | * [github/jonschlinkert](https://github.com/jonschlinkert)
|
---|
79 | * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
---|
80 |
|
---|
81 | ### License
|
---|
82 |
|
---|
83 | Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
---|
84 | Released under the [MIT License](LICENSE).
|
---|
85 |
|
---|
86 | ***
|
---|
87 |
|
---|
88 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 20, 2017._ |
---|