Add isNil and isUndefined
This commit is contained in:
14
snippets/isNil.md
Normal file
14
snippets/isNil.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
### isNil
|
||||||
|
|
||||||
|
Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.
|
||||||
|
|
||||||
|
Use the strict equality operator to check if the value and of `val` are equal to `null` or `undefined`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const isNil = val => val === undefined || val === null;
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
isNil(null); // true
|
||||||
|
isNil(undefined); // true
|
||||||
|
```
|
||||||
13
snippets/isUndefined.md
Normal file
13
snippets/isUndefined.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
### isUndefined
|
||||||
|
|
||||||
|
Returns `true` if the specified value is `undefined`, `false` otherwise.
|
||||||
|
|
||||||
|
Use the strict equality operator to check if the value and of `val` are equal to `undefined`.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const isUndefined = val => val === undefined;
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
isUndefined(undefined); // true
|
||||||
|
```
|
||||||
@ -89,6 +89,7 @@ isEven:math
|
|||||||
isFunction:type,function
|
isFunction:type,function
|
||||||
isLowerCase:string,utility
|
isLowerCase:string,utility
|
||||||
isMap:type
|
isMap:type
|
||||||
|
isNil:type
|
||||||
isNull:type
|
isNull:type
|
||||||
isNumber:type,math
|
isNumber:type,math
|
||||||
isObject:type,object
|
isObject:type,object
|
||||||
@ -102,6 +103,7 @@ isString:type,string
|
|||||||
isSymbol:type
|
isSymbol:type
|
||||||
isTravisCI:node
|
isTravisCI:node
|
||||||
isTypedArray:type
|
isTypedArray:type
|
||||||
|
isUndefined:type
|
||||||
isUpperCase:string,utility
|
isUpperCase:string,utility
|
||||||
isValidJSON:type,json
|
isValidJSON:type,json
|
||||||
isWeakMap:type
|
isWeakMap:type
|
||||||
|
|||||||
Reference in New Issue
Block a user