UNPKG

@vitruvius-labs/ts-predicate

Version:
9 lines (8 loc) 381 B
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 };