UNPKG

mic-inspector

Version:

A react inspector which a most similar of Chorme DevTools inspector

26 lines (25 loc) 692 B
/** * Return a boolean represents whether the property value is an object or a function * @param propertyValue Property value * @param descriptor Property decsriptor */ export const isObjectOrFunction = (propertyValue, descriptor) => { // if descriptor existed if (descriptor) { // if the get accessor existed if (descriptor.get) { return false; } propertyValue = descriptor.value; } switch (typeof propertyValue) { case 'string': case 'boolean': case 'number': case 'symbol': case 'bigint': case 'undefined': return false; } return propertyValue !== null; };