@pokt-network/pocket-js
Version:
Pocket-js core package with the main functionalities to interact with the Pocket Network.
17 lines • 641 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeGuard = void 0;
/**
* A generic type guard function to verify the class of a particular object, specially used for Error checks
* @param o Object to check the class for
* @param className The class to check against
*/
function typeGuard(o, className) {
var localPrimitiveOrConstructor = className;
if (typeof localPrimitiveOrConstructor === "string") {
return typeof o === localPrimitiveOrConstructor;
}
return o instanceof localPrimitiveOrConstructor;
}
exports.typeGuard = typeGuard;
//# sourceMappingURL=type-guard.js.map