UNPKG

guardz

Version:

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

34 lines (33 loc) 989 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAny = void 0; /** * A type guard function that always returns true for any value. * * This is useful when you need a type guard that accepts any type, * typically for testing or when building generic type guard compositions. * * @param _value - The value to check (always passes) * @param _config - Optional configuration (unused) * @returns Always returns true * * @example * ```typescript * import { isAny } from 'guardz'; * * console.log(isAny("hello")); // true * console.log(isAny(123)); // true * console.log(isAny(null)); // true * console.log(isAny(undefined)); // true * console.log(isAny({})); // true * console.log(isAny([])); // true * * // Useful in type guard compositions * import { isArrayWithEachItem } from 'guardz'; * const isArrayOfAnything = isArrayWithEachItem(isAny); * ``` */ const isAny = function (_value) { return true; }; exports.isAny = isAny;