UNPKG

@kitiumai/utils-ts

Version:

Comprehensive TypeScript utilities for KitiumAI projects

51 lines 1.41 kB
/** * Types Integration Utilities * Re-exports and utilities for @kitiumai/types 2.0 */ export type { IsoDateTimeString } from '@kitiumai/types/primitives'; type Brand<T, B extends string> = T & { readonly $brand: B; }; /** * Type guard to check if a value is branded */ export declare function isBranded<T, B extends string>(value: unknown): value is Brand<T, B>; /** * Safely brand a value */ export declare function brandValue<T, B extends string>(value: T, _brand: B): Brand<T, B>; /** * Remove brand from a value */ export declare function unbrand<T, B extends string>(value: Brand<T, B>): T; /** * Type-safe ID utilities using branded types */ export declare const idUtils: { /** * Create a branded ID from a string */ create: <B extends string>(id: string, _brand: B) => Brand<string, B>; /** * Check if an ID is valid (non-empty string) */ isValid: (id: unknown) => id is string; /** * Compare two branded IDs */ equals: <B extends string>(id1: Brand<string, B>, id2: Brand<string, B>) => boolean; }; /** * Email validation utilities using @kitiumai/types */ export declare const emailUtils: { /** * Basic email validation regex */ isValid: (email: unknown) => email is string; /** * Normalize email (lowercase, trim) */ normalize: (email: string) => string; }; //# sourceMappingURL=types.d.ts.map