decova-dotnet
Version:
This package provides fundumentals that a .net developer may miss while working with Typescript, whether they are missing functinalities or funcionalities provided in a non-elegant design in javascript. Bad naming, bad design of optional parameters, non-c
31 lines • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Is = void 0;
const src_1 = require("src");
class ObjInvestigator {
constructor(obj) {
this.obj = obj;
}
OfType(type) {
var _a;
let proto = Object.getPrototypeOf(this.obj);
if (!proto)
throw new src_1.Exception(`xIs() failed: Object.getPrototypeOf(${(_a = this.constructor) === null || _a === void 0 ? void 0 : _a.name}) is undefined!`);
while (proto) {
if (proto.constructor === type)
return true;
}
return false;
}
Array() {
return Array.isArray(this.obj);
}
Primitive() {
return this.obj !== Object(this.obj);
}
}
function Is(obj) {
return new ObjInvestigator(obj);
}
exports.Is = Is;
//# sourceMappingURL=CheckObj.js.map