n4s
Version:
typed schema validation version of enforce
21 lines (19 loc) • 571 B
text/typescript
import { isNotUndefined as isNotUndefinedValue } from 'vest-utils';
/**
* Validates that a value is not undefined.
* Inverse of isUndefined. Note: null passes this check.
*
* @param value - Value to validate
* @returns True if value is not undefined
*
* @example
* ```typescript
* enforce(null).isNotUndefined(); // passes
* enforce(0).isNotUndefined(); // passes
* enforce('').isNotUndefined(); // passes
* enforce(undefined).isNotUndefined(); // fails
* ```
*/
export function isNotUndefined(value: any): boolean {
return isNotUndefinedValue(value);
}