Skip to content

Instantly share code, notes, and snippets.

@wesleybliss
Created December 17, 2020 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wesleybliss/3cf21838606f4d610f3c8be602c1533b to your computer and use it in GitHub Desktop.
Save wesleybliss/3cf21838606f4d610f3c8be602c1533b to your computer and use it in GitHub Desktop.
Check if isPrimitive #js
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