Travis build: 1321

This commit is contained in:
30secondsofcode
2018-01-19 12:01:55 +00:00
parent 1cdc03acbb
commit 17abe97036
3 changed files with 29 additions and 2 deletions

View File

@ -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

View File

@ -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
``` ```