UNPKG

@kitiumai/utils-ts

Version:

Comprehensive TypeScript utilities for KitiumAI projects

67 lines 1.39 kB
/** * Types Integration Utilities * Re-exports and utilities for @kitiumai/types 2.0 */ /** * Type guard to check if a value is branded */ export function isBranded(value) { return value !== null && value !== undefined; } /** * Safely brand a value */ export function brandValue(value, _brand) { return value; } /** * Remove brand from a value */ export function unbrand(value) { return value; } /** * Type-safe ID utilities using branded types */ export const idUtils = { /** * Create a branded ID from a string */ create: (id, _brand) => { return id; }, /** * Check if an ID is valid (non-empty string) */ isValid: (id) => { return typeof id === 'string' && id.length > 0; }, /** * Compare two branded IDs */ equals: (id1, id2) => { return id1 === id2; }, }; /** * Email validation utilities using @kitiumai/types */ export const emailUtils = { /** * Basic email validation regex */ isValid: (email) => { if (typeof email !== 'string') { return false; } const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return emailRegex.test(email); }, /** * Normalize email (lowercase, trim) */ normalize: (email) => { return email.toLowerCase().trim(); }, }; //# sourceMappingURL=types.js.map