This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const types = 'Boolean Number String Function Array Date RegExp Object Error'.split(' ') | |
const class2type = {} | |
types.forEach(name => { | |
class2type['[object ' + name + ']'] = name.toLowerCase() | |
}) | |
function type (obj) { | |
if (obj === null) { | |
return obj + '' | |
} |
OlderNewer