UNPKG

shadow-function

Version:

ioing lib - shadow Function, worker Function

20 lines (15 loc) 362 B
'use strict' const getObjectType = (object: object): string => { const objectStr = Object.prototype.toString.call(object) const objectType = (/\s*\[(\w+) (\w+)\]\s*/.exec(objectStr) || []) switch (objectType[1]) { case 'object': return objectType[2] case 'native': return 'native' } return 'unknow' } export { getObjectType }