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.
88 lines
4.0 KiB
88 lines
4.0 KiB
2 years ago
|
# is-extendable [](https://www.npmjs.com/package/is-extendable) [](https://npmjs.org/package/is-extendable) [](https://npmjs.org/package/is-extendable) [](https://travis-ci.org/jonschlinkert/is-extendable)
|
||
|
|
||
|
> Returns true if a value is a plain object, array or function.
|
||
|
|
||
|
## Install
|
||
|
|
||
|
Install with [npm](https://www.npmjs.com/):
|
||
|
|
||
|
```sh
|
||
|
$ npm install --save is-extendable
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```js
|
||
|
var isExtendable = require('is-extendable');
|
||
|
```
|
||
|
|
||
|
Returns true if the value is any of the following:
|
||
|
|
||
|
* array
|
||
|
* plain object
|
||
|
* function
|
||
|
|
||
|
## Notes
|
||
|
|
||
|
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:
|
||
|
|
||
|
* the value is not a primitive, or
|
||
|
* that the object is a plain object, function or array
|
||
|
|
||
|
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`.
|
||
|
|
||
|
## Release history
|
||
|
|
||
|
### v1.0.0 - 2017/07/20
|
||
|
|
||
|
**Breaking changes**
|
||
|
|
||
|
* No longer considers date, regex or error objects to be extendable
|
||
|
|
||
|
## About
|
||
|
|
||
|
### Related projects
|
||
|
|
||
|
* [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.")
|
||
|
* [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.")
|
||
|
* [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.")
|
||
|
* [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.")
|
||
|
* [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.")
|
||
|
|
||
|
### Contributing
|
||
|
|
||
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
||
|
|
||
|
### Building docs
|
||
|
|
||
|
_(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.)_
|
||
|
|
||
|
To generate the readme, run the following command:
|
||
|
|
||
|
```sh
|
||
|
$ npm install -g verbose/verb#dev verb-generate-readme && verb
|
||
|
```
|
||
|
|
||
|
### Running tests
|
||
|
|
||
|
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:
|
||
|
|
||
|
```sh
|
||
|
$ npm install && npm test
|
||
|
```
|
||
|
|
||
|
### Author
|
||
|
|
||
|
**Jon Schlinkert**
|
||
|
|
||
|
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
||
|
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
|
||
|
|
||
|
### License
|
||
|
|
||
|
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
|
||
|
Released under the [MIT License](LICENSE).
|
||
|
|
||
|
***
|
||
|
|
||
|
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 20, 2017._
|