UNPKG

guardz

Version:

A simple and lightweight TypeScript type guard library for runtime type validation.

17 lines (16 loc) 599 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createValidationResult = void 0; /** * Create a validation result object * @param valid - Whether the validation passed * @param errors - Array of validation errors (default: empty array) * @param tree - Optional validation tree structure * @returns A ValidationResult object */ const createValidationResult = (valid, errors = [], tree) => ({ valid, errors: Array.isArray(errors) ? [...errors] : [], ...(tree && { tree: { ...tree } }) }); exports.createValidationResult = createValidationResult;