UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and

49 lines (48 loc) 1.5 kB
/** * Comprehensive Type Alias Library * Centralizes commonly used complex types to improve readability and maintainability */ // ============================================================================ // TYPE GUARDS AND UTILITIES // ============================================================================ /** * Type guard for checking if value is a StandardRecord * * @param value - Value to check * @returns True if value is a non-null object (but not an array) * * @example * ```typescript * if (isStandardRecord(data)) { * // TypeScript now knows data is Record<string, unknown> * console.log(data.someProperty); * } * ``` */ export function isStandardRecord(value) { return typeof value === "object" && value !== null && !Array.isArray(value); } /** * Type guard for checking if value is a JsonRecord */ export function isJsonRecord(value) { return (isStandardRecord(value) && Object.values(value).every((val) => val === null || typeof val === "string" || typeof val === "number" || typeof val === "boolean" || Array.isArray(val) || isJsonRecord(val))); } /** * Type guard for checking if value is a StringArray */ export function isStringArray(value) { return (Array.isArray(value) && value.every((item) => typeof item === "string")); } /** * Type guard for checking if value is an AsyncFunction */ export function isAsyncFunction(value) { return typeof value === "function"; }