Another primitive assert function

This commit is contained in:
laohan
2018-10-12 15:12:43 +08:00
parent 60e4d3895f
commit c24d312673

View File

@ -7,7 +7,7 @@ supplying the type using `typeof`.
Since `typeof null` evaluates to `'object'`, it needs to be directly compared.
```js
const isPrimitive = val => !['object', 'function'].includes(typeof val) || val === null;
const isPrimitive = val => Object(val) !== val;
```
```js