Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 309 Bytes

getType.md

File metadata and controls

11 lines (8 loc) · 309 Bytes

getType

Returns the native type of a value.

Returns lower-cased constructor name of value, "undefined" or "null" if value is undefined or null

const getType = v =>
  v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();
// getType(new Set([1,2,3])) -> "set"