Created
December 17, 2020 15:11
-
-
Save wesleybliss/3cf21838606f4d610f3c8be602c1533b to your computer and use it in GitHub Desktop.
Check if isPrimitive #js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const isPrimitive = val => { | |
const type = typeof val | |
if (Array.isArray(val)) return false | |
if (type === 'object') return val === null | |
return type !== 'function' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment