From aa23a95f6c6ded6304cb862bbf90d2ba6e217bf8 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Sun, 4 Feb 2018 04:09:45 +0000 Subject: [PATCH] Travis build: 1533 --- README.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2543c7f4a..44bf25bb4 100644 --- a/README.md +++ b/README.md @@ -7108,7 +7108,7 @@ isObjectLike(null); // false ### isPlainObject -Checks if the provided value is an bbject created by the Object constructor. +Checks if the provided value is an object 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`. diff --git a/docs/index.html b/docs/index.html index 0cb5c6ee1..bfc5d3051 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1665,7 +1665,7 @@ Foo.prototypeisObjectLike([1, 2, 3]); // true isObjectLike(x => x); // false isObjectLike(null); // false -
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.
const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object; +
Checks if the provided value is an object 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.
const isPlainObject = val => !!val && typeof val === 'object' && val.constructor === Object;
isPlainObject({ a: 1 }); // true isPlainObject(new Map()); // false
Returns a boolean determining if the passed value is primitive or not.
Use Array.includes() on an array of type strings which are not primitive, supplying the type using typeof. Since typeof null evaluates to 'object', it needs to be directly compared.
const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null;