@vitruvius-labs/ts-predicate
Version:
TypeScript predicates library
9 lines (8 loc) • 381 B
JavaScript
import { hasNullableProperty } from "../type-guard/has-nullable-property.mjs";
import { ValidationError } from "./utils/validation-error.mjs";
function assertNullableProperty(value, property) {
if (!hasNullableProperty(value, property)) {
throw new ValidationError(`The value must have a property "${property.toString()}".`);
}
}
export { assertNullableProperty };