Travis build: 1321
This commit is contained in:
24
README.md
24
README.md
@ -342,6 +342,7 @@ average(1, 2, 3);
|
|||||||
* [`isNull`](#isnull)
|
* [`isNull`](#isnull)
|
||||||
* [`isNumber`](#isnumber)
|
* [`isNumber`](#isnumber)
|
||||||
* [`isObject`](#isobject)
|
* [`isObject`](#isobject)
|
||||||
|
* [`isPlainObject`](#isplainobject)
|
||||||
* [`isPrimitive`](#isprimitive)
|
* [`isPrimitive`](#isprimitive)
|
||||||
* [`isPromiseLike`](#ispromiselike)
|
* [`isPromiseLike`](#ispromiselike)
|
||||||
* [`isString`](#isstring)
|
* [`isString`](#isstring)
|
||||||
@ -5632,6 +5633,29 @@ isObject(true); // false
|
|||||||
<br>[⬆ Back to top](#table-of-contents)
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
|
### isPlainObject
|
||||||
|
|
||||||
|
Checks if the provided value is an bbject created by the Object constructor.
|
||||||
|
|
||||||
|
Check if the provided value is truthy, use `typeof` to check if it is an object and `Object.constructor` to make sure the constructor is equal to `Object`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object;
|
||||||
|
```
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>Examples</summary>
|
||||||
|
|
||||||
|
```js
|
||||||
|
isPlainObject({ a: 1 }); // true
|
||||||
|
isPlainObject(new Map()); // false
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<br>[⬆ Back to top](#table-of-contents)
|
||||||
|
|
||||||
|
|
||||||
### isPrimitive
|
### isPrimitive
|
||||||
|
|
||||||
Returns a boolean determining if the passed value is primitive or not.
|
Returns a boolean determining if the passed value is primitive or not.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -9,6 +9,6 @@ const isPlainObject = val => !!val && typeof val === 'object' && val.constructor
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
isPlainObject({ 'a': 1 }); // true
|
isPlainObject({ a: 1 }); // true
|
||||||
isPlainObject(new Map()); // false
|
isPlainObject(new Map()); // false
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user