@beenotung/tslib
Version:
utils library in Typescript
15 lines (14 loc) • 408 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getObjectType = getObjectType;
function getObjectType(o) {
const type = Object.prototype.toString.call(o);
const match = type.match(/^\[object (.*)]$/);
if (match) {
const res = match[1];
if (res) {
return res;
}
}
return type.replace(/^\[/, '').replace(/]$/, '');
}