UNPKG

guardz

Version:

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

21 lines (20 loc) 681 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createTreeNode = void 0; /** * Create a validation tree node * @param path - The path of this node in the validation tree * @param valid - Whether this node is valid * @param expectedType - Optional expected type for this node * @param actualValue - Optional actual value for this node * @returns A ValidationTree node */ const createTreeNode = (path, valid, expectedType, actualValue) => ({ valid, path, ...(expectedType && { expectedType }), ...(actualValue !== undefined && { actualValue }), children: {}, errors: [] }); exports.createTreeNode = createTreeNode;