@n3okill/utils
Version:
Many javascript helpers
16 lines • 709 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPropertyDefinedWithThrow = isPropertyDefinedWithThrow;
const isPropertyDefined_1 = require("./isPropertyDefined");
/**
* Throws an error if property is not defined in the given object
* @param obj Object where to search for the property
* @param name The name of the property can be on the form "a.b.c[1].d"
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isPropertyDefinedWithThrow(obj, name) {
if (!(0, isPropertyDefined_1.isPropertyDefined)(obj, name)) {
throw new TypeError(`'${name}' property is not defined.`);
}
}
//# sourceMappingURL=isPropertyDefinedWithThrow.js.map
;