Add isObjectLike.md
This commit is contained in:
16
snippets/isObjectLike.md
Normal file
16
snippets/isObjectLike.md
Normal file
@ -0,0 +1,16 @@
|
||||
### isObjectLike
|
||||
|
||||
Checks if a value is object-like.
|
||||
|
||||
Check if the provided value is not `null` and its `typeof` is equal to `'object'`.
|
||||
|
||||
```js
|
||||
const isObjectLike = val => val !== null && typeof val === 'object';
|
||||
```
|
||||
|
||||
```js
|
||||
isObjectLike({}); // true
|
||||
isObjectLike([1, 2, 3]); // true
|
||||
isObjectLike(x => x); // false
|
||||
isObjectLike(null); // false
|
||||
```
|
||||
@ -101,6 +101,7 @@ isNil:type
|
||||
isNull:type
|
||||
isNumber:type,math
|
||||
isObject:type,object
|
||||
isObjectLike:type,object
|
||||
isPlainObject:type,object
|
||||
isPrime:math
|
||||
isPrimitive:type,function,array,string
|
||||
|
||||
Reference in New Issue
Block a user