UNPKG

mout

Version:

Modular Utilities

18 lines (15 loc) 415 B
/** * Checks if the object is a primitive */ function isPrimitive(value: any): boolean { // Using switch fallthrough because it's simple to read and is // generally fast: http://jsperf.com/testing-value-is-primitive/5 switch (typeof value) { case 'string': case 'number': case 'boolean': return true; } return value == null; } export default isPrimitive;