fix naming
This commit is contained in:
9
snippets/get-type.md
Normal file
9
snippets/get-type.md
Normal file
@ -0,0 +1,9 @@
|
||||
### Get native type of value
|
||||
|
||||
Returns lower-cased constructor name of value, "undefined" or "null" if value is undefined or null
|
||||
|
||||
```js
|
||||
const getType = v =>
|
||||
v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();
|
||||
// getType(new Set([1,2,3])) -> "set"
|
||||
```
|
||||
Reference in New Issue
Block a user