moltres-utils
Version:
Utils for Moltres apps
45 lines (36 loc) • 1.06 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const _Object$prototype = Object.prototype,
hasOwnProperty = _Object$prototype.hasOwnProperty,
toString = _Object$prototype.toString;
const symToStringTag = typeof Symbol != 'undefined' ? Symbol.toStringTag : undefined;
const baseGetTag = value => {
if (value == null) {
return value === undefined ? '[object Undefined]' : '[object Null]';
}
if (!(symToStringTag && symToStringTag in Object(value))) {
return toString.call(value);
}
const isOwn = hasOwnProperty.call(value, symToStringTag);
const tag = value[symToStringTag];
let unmasked = false;
try {
value[symToStringTag] = undefined;
unmasked = true;
} catch (e) {}
const result = toString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
};
var _default = baseGetTag;
exports.default = _default;
//# sourceMappingURL=baseGetTag.js.map
;