@entrolytics/utilities 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/string.ts","../src/date.ts","../src/url.ts","../src/hash.ts","../src/retry.ts","../src/debounce.ts","../src/throttle.ts","../src/storage.ts"],"names":[],"mappings":";;;AAOO,SAAS,QAAA,CAAS,GAAA,EAAa,SAAA,EAAmB,MAAA,GAAS,KAAA,EAAe;AAC/E,EAAA,IAAI,GAAA,CAAI,MAAA,IAAU,SAAA,EAAW,OAAO,GAAA;AACpC,EAAA,OAAO,IAAI,KAAA,CAAM,CAAA,EAAG,SAAA,GAAY,MAAA,CAAO,MAAM,CAAA,GAAI,MAAA;AACnD;AAKO,SAAS,WAAW,GAAA,EAAqB;AAC9C,EAAA,OAAO,GAAA,CAAI,MAAA,CAAO,CAAC,CAAA,CAAE,WAAA,KAAgB,GAAA,CAAI,KAAA,CAAM,CAAC,CAAA,CAAE,WAAA,EAAY;AAChE;AAKO,SAAS,YAAY,GAAA,EAAqB;AAC/C,EAAA,OAAO,GAAA,CACJ,QAAQ,iBAAA,EAAmB,OAAO,EAClC,OAAA,CAAQ,SAAA,EAAW,GAAG,CAAA,CACtB,WAAA,EAAY;AACjB;AAKO,SAAS,YAAY,GAAA,EAAqB;AAC/C,EAAA,OAAO,GAAA,CACJ,WAAA,EAAY,CACZ,OAAA,CAAQ,mBAAA,EAAqB,CAAC,CAAA,EAAG,GAAA,KAAQ,GAAA,CAAI,WAAA,EAAa,CAAA;AAC/D;AAKO,SAAS,YAAY,GAAA,EAAqB;AAC/C,EAAA,OAAO,GAAA,CACJ,QAAQ,iBAAA,EAAmB,OAAO,EAClC,OAAA,CAAQ,SAAA,EAAW,GAAG,CAAA,CACtB,WAAA,EAAY;AACjB;AAKO,SAAS,aAAa,MAAA,EAAwB;AACnD,EAAA,MAAM,KAAA,GAAQ,gEAAA;AACd,EAAA,IAA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A;AAAA;AAAA,EAKA,OAAO,GAAA,EAAmB;AACxB,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,IAAA,IAAI;AACF,MAAA,MAAA,CAAO,cAAA,CAAe,WAAW,GAAG,CAAA;AAAA,IACtC,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,yCAAyC,KAAK,CAAA;AAAA,IAC9D;AAAA,EACF,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA,GAAc;AACZ,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,IAAA,IAAI;AACF,MAAA,MAAA,CAAO,eAAe,KAAA,EAAM;AAAA,IAC9B,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,mCAAmC,KAAK,CAAA;AAAA,IACxD;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["/**\n * String utility functions\n */\n\n/**\n * Truncate a string to a maximum length\n */\nexport function truncate(str: string, maxLength: number, suffix = '...'): string {\n if (str.length <= maxLength) return str;\n return str.slice(0, maxLength - suffix.length) + suffix;\n}\n\n/**\n * Capitalize the first letter of a string\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n}\n\n/**\n * Convert string to kebab-case\n */\nexport function toKebabCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[\\s_]+/g, '-')\n .toLowerCase();\n}\n\n/**\n * Convert string to camelCase\n */\nexport function toCamelCase(str: string): string {\n return str\n .toLowerCase()\n .replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase());\n}\n\n/**\n * Convert string to snake_case\n */\nexport function toSnakeCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s-]+/g, '_')\n .toLowerCase();\n}\n\n/**\n * Generate a random alphanumeric string\n */\nexport function randomString(length: number): string {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n let result = '';\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return result;\n}\n\n/**\n * Slugify a string for URLs\n */\nexport function slugify(str: string): string {\n return str\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, '')\n .replace(/[\\s_-]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n","/**\n * Date utility functions\n */\n\n/**\n * Format date to ISO string\n */\nexport function toISOString(date: Date | string | number): string {\n return new Date(date).toISOString();\n}\n\n/**\n * Format date to YYYY-MM-DD\n */\nexport function toDateString(date: Date | string | number): string {\n const d = new Date(date);\n const year = d.getFullYear();\n const month = String(d.getMonth() + 1).padStart(2, '0');\n const day = String(d.getDate()).padStart(2, '0');\n return `${year}-${month}-${day}`;\n}\n\n/**\n * Get date range for the last N days\n */\nexport function getLastNDays(n: number): { startDate: Date; endDate: Date } {\n const endDate = new Date();\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - n);\n return { startDate, endDate };\n}\n\n/**\n * Check if a date is today\n */\nexport function isToday(date: Date | string | number): boolean {\n const d = new Date(date);\n const today = new Date();\n return d.toDateString() === today.toDateString();\n}\n\n/**\n * Add days to a date\n */\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n}\n\n/**\n * Get start of day\n */\nexport function startOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\n/**\n * Get end of day\n */\nexport function endOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(23, 59, 59, 999);\n return result;\n}\n\n/**\n * Get difference in days between two dates\n */\nexport function daysDifference(date1: Date, date2: Date): number {\n const oneDay = 24 * 60 * 60 * 1000;\n return Math.round(Math.abs((date1.getTime() - date2.getTime()) / oneDay));\n}\n","/**\n * URL utility functions\n */\n\n/**\n * Parse query parameters from URL\n */\nexport function parseQueryParams(url: string): Record<string, string> {\n const params: Record<string, string> = {};\n const urlObj = new URL(url);\n urlObj.searchParams.forEach((value, key) => {\n params[key] = value;\n });\n return params;\n}\n\n/**\n * Build query string from object\n */\nexport function buildQueryString(params: Record<string, unknown>): string {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n return searchParams.toString();\n}\n\n/**\n * Get domain from URL\n */\nexport function getDomain(url: string): string {\n try {\n const urlObj = new URL(url);\n return urlObj.hostname;\n } catch {\n return '';\n }\n}\n\n/**\n * Get pathname from URL\n */\nexport function getPathname(url: string): string {\n try {\n const urlObj = new URL(url);\n return urlObj.pathname;\n } catch {\n return '';\n }\n}\n\n/**\n * Validate URL\n */\nexport function isValidUrl(url: string): boolean {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Combine URL parts\n */\nexport function combineUrl(base: string, ...paths: string[]): string {\n let url = base.replace(/\\/+$/, '');\n for (const path of paths) {\n url += '/' + path.replace(/^\\/+/, '');\n }\n return url;\n}\n","/**\n * Hashing utility functions\n */\n\n/**\n * Simple hash function for strings (non-cryptographic)\n */\nexport function simpleHash(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash |= 0; // Convert to 32bit integer\n }\n return Math.abs(hash);\n}\n\n/**\n * Generate a simple hash string from input\n */\nexport function hashString(str: string): string {\n return simpleHash(str).toString(36);\n}\n\n/**\n * Generate a deterministic ID from multiple values\n */\nexport function generateId(...values: (string | number)[]): string {\n const combined = values.join('|');\n return hashString(combined);\n}\n","/**\n * Retry utility with exponential backoff\n */\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoffMultiplier?: number;\n maxDelayMs?: number;\n onRetry?: (error: Error, attempt: number) => void;\n}\n\n/**\n * Retry a function with exponential backoff\n */\nexport async function retry<T>(\n fn: () => Promise<T>,\n options: RetryOptions = {}\n): Promise<T> {\n const {\n maxAttempts = 3,\n delayMs = 1000,\n backoffMultiplier = 2,\n maxDelayMs = 30000,\n onRetry,\n } = options;\n\n let lastError: Error;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n\n if (attempt === maxAttempts) {\n throw lastError;\n }\n\n const delay = Math.min(delayMs * Math.pow(backoffMultiplier, attempt - 1), maxDelayMs);\n\n if (onRetry) {\n onRetry(lastError, attempt);\n }\n\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n\n throw lastError!;\n}\n","/**\n * Debounce utility\n */\n\n// biome-ignore lint: any is needed for generic function signature\nexport function debounce<T extends (...args: any[]) => any>(\n func: T,\n waitMs: number\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n return function debounced(...args: Parameters<T>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n }, waitMs);\n };\n}\n","/**\n * Throttle utility\n */\n\n// biome-ignore lint: any is needed for generic function signature\nexport function throttle<T extends (...args: any[]) => any>(\n func: T,\n limitMs: number\n): (...args: Parameters<T>) => void {\n let inThrottle = false;\n let lastArgs: Parameters<T> | null = null;\n\n return function throttled(...args: Parameters<T>) {\n if (!inThrottle) {\n func(...args);\n inThrottle = true;\n\n setTimeout(() => {\n inThrottle = false;\n if (lastArgs !== null) {\n throttled(...lastArgs);\n lastArgs = null;\n }\n }, limitMs);\n } else {\n lastArgs = args;\n }\n };\n}\n","/**\n * Storage utility functions for browser localStorage/sessionStorage\n */\n\n/**\n * Safe localStorage wrapper\n */\nexport const storage = {\n /**\n * Get item from localStorage with JSON parsing\n */\n get<T>(key: string, defaultValue?: T): T | null {\n if (typeof window === 'undefined') return defaultValue ?? null;\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : (defaultValue ?? null);\n } catch {\n return defaultValue ?? null;\n }\n },\n\n /**\n * Set item in localStorage with JSON stringification\n */\n set<T>(key: string, value: T): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.localStorage.setItem(key, JSON.stringify(value));\n } catch (error) {\n console.error('Failed to set localStorage item:', error);\n }\n },\n\n /**\n * Remove item from localStorage\n */\n remove(key: string): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.localStorage.removeItem(key);\n } catch (error) {\n console.error('Failed to remove localStorage item:', error);\n }\n },\n\n /**\n * Clear all localStorage\n */\n clear(): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.localStorage.clear();\n } catch (error) {\n console.error('Failed to clear localStorage:', error);\n }\n },\n};\n\n/**\n * Safe sessionStorage wrapper\n */\nexport const sessionStorage = {\n /**\n * Get item from sessionStorage with JSON parsing\n */\n get<T>(key: string, defaultValue?: T): T | null {\n if (typeof window === 'undefined') return defaultValue ?? null;\n\n try {\n const item = window.sessionStorage.getItem(key);\n return item ? JSON.parse(item) : (defaultValue ?? null);\n } catch {\n return defaultValue ?? null;\n }\n },\n\n /**\n * Set item in sessionStorage with JSON stringification\n */\n set<T>(key: string, value: T): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.sessionStorage.setItem(key, JSON.stringify(value));\n } catch (error) {\n console.error('Failed to set sessionStorage item:', error);\n }\n },\n\n /**\n * Remove item from sessionStorage\n */\n remove(key: string): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.sessionStorage.removeItem(key);\n } catch (error) {\n console.error('Failed to remove sessionStorage item:', error);\n }\n },\n\n /**\n * Clear all sessionStorage\n */\n clear(): void {\n if (typeof window === 'undefined') return;\n\n try {\n window.sessionStorage.clear();\n } catch (error) {\n console.error('Failed to clear sessionStorage:', error);\n }\n },\n};\n"]}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/date.ts","../src/debounce.ts","../src/hash.ts","../src/retry.ts","../src/storage.ts","../src/string.ts","../src/throttle.ts","../src/url.ts"],"sourcesContent":["/**\n * Date utility functions\n */\n\n/**\n * Format date to ISO string\n */\nexport function toISOString(date: Date | string | number): string {\n return new Date(date).toISOString();\n}\n\n/**\n * Format date to YYYY-MM-DD\n */\nexport function toDateString(date: Date | string | number): string {\n const d = new Date(date);\n const year = d.getFullYear();\n const month = String(d.getMonth() + 1).padStart(2, \"0\");\n const day = String(d.getDate()).padStart(2, \"0\");\n return `${year}-${month}-${day}`;\n}\n\n/**\n * Get date range for the last N days\n */\nexport function getLastNDays(n: number): { startDate: Date; endDate: Date } {\n const endDate = new Date();\n const startDate = new Date();\n startDate.setDate(startDate.getDate() - n);\n return { startDate, endDate };\n}\n\n/**\n * Check if a date is today\n */\nexport function isToday(date: Date | string | number): boolean {\n const d = new Date(date);\n const today = new Date();\n return d.toDateString() === today.toDateString();\n}\n\n/**\n * Add days to a date\n */\nexport function addDays(date: Date, days: number): Date {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n}\n\n/**\n * Get start of day\n */\nexport function startOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(0, 0, 0, 0);\n return result;\n}\n\n/**\n * Get end of day\n */\nexport function endOfDay(date: Date): Date {\n const result = new Date(date);\n result.setHours(23, 59, 59, 999);\n return result;\n}\n\n/**\n * Get difference in days between two dates\n */\nexport function daysDifference(date1: Date, date2: Date): number {\n const oneDay = 24 * 60 * 60 * 1000;\n return Math.round(Math.abs((date1.getTime() - date2.getTime()) / oneDay));\n}\n","/**\n * Debounce utility\n */\n\nexport function debounce<T extends (...args: unknown[]) => unknown>(\n func: T,\n waitMs: number,\n): (...args: Parameters<T>) => void {\n let timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n return function debounced(...args: Parameters<T>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n }, waitMs);\n };\n}\n","/**\n * Hashing utility functions\n */\n\n/**\n * Simple hash function for strings (non-cryptographic)\n */\nexport function simpleHash(str: string): number {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash |= 0; // Convert to 32bit integer\n }\n return Math.abs(hash);\n}\n\n/**\n * Generate a simple hash string from input\n */\nexport function hashString(str: string): string {\n return simpleHash(str).toString(36);\n}\n\n/**\n * Generate a deterministic ID from multiple values\n */\nexport function generateId(...values: (string | number)[]): string {\n const combined = values.join(\"|\");\n return hashString(combined);\n}\n","/**\n * Retry utility with exponential backoff\n */\n\nexport interface RetryOptions {\n maxAttempts?: number;\n delayMs?: number;\n backoffMultiplier?: number;\n maxDelayMs?: number;\n onRetry?: (error: Error, attempt: number) => void;\n}\n\n/**\n * Retry a function with exponential backoff\n */\nexport async function retry<T>(fn: () => Promise<T>, options: RetryOptions = {}): Promise<T> {\n const {\n maxAttempts = 3,\n delayMs = 1000,\n backoffMultiplier = 2,\n maxDelayMs = 30000,\n onRetry,\n } = options;\n\n let lastError: Error;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n return await fn();\n } catch (error) {\n lastError = error as Error;\n\n if (attempt === maxAttempts) {\n throw lastError;\n }\n\n const delay = Math.min(delayMs * backoffMultiplier ** (attempt - 1), maxDelayMs);\n\n if (onRetry) {\n onRetry(lastError, attempt);\n }\n\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n\n throw lastError!;\n}\n","/**\n * Storage utility functions for browser localStorage/sessionStorage\n */\n\n/**\n * Safe localStorage wrapper\n */\nexport const storage = {\n /**\n * Get item from localStorage with JSON parsing\n */\n get<T>(key: string, defaultValue?: T): T | null {\n if (typeof window === \"undefined\") return defaultValue ?? null;\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : (defaultValue ?? null);\n } catch {\n return defaultValue ?? null;\n }\n },\n\n /**\n * Set item in localStorage with JSON stringification\n */\n set<T>(key: string, value: T): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.localStorage.setItem(key, JSON.stringify(value));\n } catch (error) {\n console.error(\"Failed to set localStorage item:\", error);\n }\n },\n\n /**\n * Remove item from localStorage\n */\n remove(key: string): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.localStorage.removeItem(key);\n } catch (error) {\n console.error(\"Failed to remove localStorage item:\", error);\n }\n },\n\n /**\n * Clear all localStorage\n */\n clear(): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.localStorage.clear();\n } catch (error) {\n console.error(\"Failed to clear localStorage:\", error);\n }\n },\n};\n\n/**\n * Safe sessionStorage wrapper\n */\nexport const sessionStorage = {\n /**\n * Get item from sessionStorage with JSON parsing\n */\n get<T>(key: string, defaultValue?: T): T | null {\n if (typeof window === \"undefined\") return defaultValue ?? null;\n\n try {\n const item = window.sessionStorage.getItem(key);\n return item ? JSON.parse(item) : (defaultValue ?? null);\n } catch {\n return defaultValue ?? null;\n }\n },\n\n /**\n * Set item in sessionStorage with JSON stringification\n */\n set<T>(key: string, value: T): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.sessionStorage.setItem(key, JSON.stringify(value));\n } catch (error) {\n console.error(\"Failed to set sessionStorage item:\", error);\n }\n },\n\n /**\n * Remove item from sessionStorage\n */\n remove(key: string): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.sessionStorage.removeItem(key);\n } catch (error) {\n console.error(\"Failed to remove sessionStorage item:\", error);\n }\n },\n\n /**\n * Clear all sessionStorage\n */\n clear(): void {\n if (typeof window === \"undefined\") return;\n\n try {\n window.sessionStorage.clear();\n } catch (error) {\n console.error(\"Failed to clear sessionStorage:\", error);\n }\n },\n};\n","/**\n * String utility functions\n */\n\n/**\n * Truncate a string to a maximum length\n */\nexport function truncate(str: string, maxLength: number, suffix = \"...\"): string {\n if (str.length <= maxLength) return str;\n return str.slice(0, maxLength - suffix.length) + suffix;\n}\n\n/**\n * Capitalize the first letter of a string\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();\n}\n\n/**\n * Convert string to kebab-case\n */\nexport function toKebabCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\n/**\n * Convert string to camelCase\n */\nexport function toCamelCase(str: string): string {\n return str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase());\n}\n\n/**\n * Convert string to snake_case\n */\nexport function toSnakeCase(str: string): string {\n return str\n .replace(/([a-z])([A-Z])/g, \"$1_$2\")\n .replace(/[\\s-]+/g, \"_\")\n .toLowerCase();\n}\n\n/**\n * Generate a random alphanumeric string\n */\nexport function randomString(length: number): string {\n const chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return result;\n}\n\n/**\n * Slugify a string for URLs\n */\nexport function slugify(str: string): string {\n return str\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n","/**\n * Throttle utility\n */\n\nexport function throttle<T extends (...args: unknown[]) => unknown>(\n func: T,\n limitMs: number,\n): (...args: Parameters<T>) => void {\n let inThrottle = false;\n let lastArgs: Parameters<T> | null = null;\n\n return function throttled(...args: Parameters<T>) {\n if (!inThrottle) {\n func(...args);\n inThrottle = true;\n\n setTimeout(() => {\n inThrottle = false;\n if (lastArgs !== null) {\n throttled(...lastArgs);\n lastArgs = null;\n }\n }, limitMs);\n } else {\n lastArgs = args;\n }\n };\n}\n","/**\n * URL utility functions\n */\n\n/**\n * Parse query parameters from URL\n */\nexport function parseQueryParams(url: string): Record<string, string> {\n const params: Record<string, string> = {};\n const urlObj = new URL(url);\n urlObj.searchParams.forEach((value, key) => {\n params[key] = value;\n });\n return params;\n}\n\n/**\n * Build query string from object\n */\nexport function buildQueryString(params: Record<string, unknown>): string {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n if (typeof value === \"string\") {\n searchParams.append(key, value);\n return;\n }\n\n if (typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"bigint\") {\n searchParams.append(key, String(value));\n return;\n }\n\n if (value instanceof Date) {\n searchParams.append(key, value.toISOString());\n return;\n }\n\n searchParams.append(key, JSON.stringify(value));\n }\n });\n return searchParams.toString();\n}\n\n/**\n * Get domain from URL\n */\nexport function getDomain(url: string): string {\n try {\n const urlObj = new URL(url);\n return urlObj.hostname;\n } catch {\n return \"\";\n }\n}\n\n/**\n * Get pathname from URL\n */\nexport function getPathname(url: string): string {\n try {\n const urlObj = new URL(url);\n return urlObj.pathname;\n } catch {\n return \"\";\n }\n}\n\n/**\n * Validate URL\n */\nexport function isValidUrl(url: string): boolean {\n try {\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Combine URL parts\n */\nexport function combineUrl(base: string, ...paths: string[]): string {\n let url = base.replace(/\\/+$/, \"\");\n for (const path of paths) {\n url += \"/\" + path.replace(/^\\/+/, \"\");\n }\n return url;\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,YAAY,MAAsC;CAChE,OAAO,IAAI,KAAK,IAAI,EAAE,YAAY;AACpC;;;;AAKA,SAAgB,aAAa,MAAsC;CACjE,MAAM,IAAI,IAAI,KAAK,IAAI;CAIvB,OAAO,GAHM,EAAE,YAGF,EAAE,GAFD,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAE7B,EAAE,GADZ,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,GACf;AAC/B;;;;AAKA,SAAgB,aAAa,GAA+C;CAC1E,MAAM,0BAAU,IAAI,KAAK;CACzB,MAAM,4BAAY,IAAI,KAAK;CAC3B,UAAU,QAAQ,UAAU,QAAQ,IAAI,CAAC;CACzC,OAAO;EAAE;EAAW;CAAQ;AAC9B;;;;AAKA,SAAgB,QAAQ,MAAuC;CAC7D,MAAM,IAAI,IAAI,KAAK,IAA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,OAAO,KAAK,CAAC;IACtC;GACF;GAEA,IAAI,iBAAiB,MAAM;IACzB,aAAa,OAAO,KAAK,MAAM,YAAY,CAAC;IAC5C;GACF;GAEA,aAAa,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;EAChD;CACF,CAAC;CACD,OAAO,aAAa,SAAS;AAC/B;;;;AAKA,SAAgB,UAAU,KAAqB;CAC7C,IAAI;EAEF,OAAO,IADY,IAAI,GACX,EAAE;CAChB,QAAQ;EACN,OAAO;CACT;AACF;;;;AAKA,SAAgB,YAAY,KAAqB;CAC/C,IAAI;EAEF,OAAO,IADY,IAAI,GACX,EAAE;CAChB,QAAQ;EACN,OAAO;CACT;AACF;;;;AAKA,SAAgB,WAAW,KAAsB;CAC/C,IAAI;EACF,IAAI,IAAI,GAAG;EACX,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;AAKA,SAAgB,WAAW,MAAc,GAAG,OAAyB;CACnE,IAAI,MAAM,KAAK,QAAQ,QAAQ,EAAE;CACjC,KAAK,MAAM,QAAQ,OACjB,OAAO,MAAM,KAAK,QAAQ,QAAQ,EAAE;CAEtC,OAAO;AACT"}
package/dist/index.d.cts CHANGED
@@ -1,35 +1,4 @@
1
- /**
2
- * String utility functions
3
- */
4
- /**
5
- * Truncate a string to a maximum length
6
- */
7
- declare function truncate(str: string, maxLength: number, suffix?: string): string;
8
- /**
9
- * Capitalize the first letter of a string
10
- */
11
- declare function capitalize(str: string): string;
12
- /**
13
- * Convert string to kebab-case
14
- */
15
- declare function toKebabCase(str: string): string;
16
- /**
17
- * Convert string to camelCase
18
- */
19
- declare function toCamelCase(str: string): string;
20
- /**
21
- * Convert string to snake_case
22
- */
23
- declare function toSnakeCase(str: string): string;
24
- /**
25
- * Generate a random alphanumeric string
26
- */
27
- declare function randomString(length: number): string;
28
- /**
29
- * Slugify a string for URLs
30
- */
31
- declare function slugify(str: string): string;
32
-
1
+ //#region src/date.d.ts
33
2
  /**
34
3
  * Date utility functions
35
4
  */
@@ -45,8 +14,8 @@ declare function toDateString(date: Date | string | number): string;
45
14
  * Get date range for the last N days
46
15
  */
47
16
  declare function getLastNDays(n: number): {
48
- startDate: Date;
49
- endDate: Date;
17
+ startDate: Date;
18
+ endDate: Date;
50
19
  };
51
20
  /**
52
21
  * Check if a date is today
@@ -68,35 +37,14 @@ declare function endOfDay(date: Date): Date;
68
37
  * Get difference in days between two dates
69
38
  */
70
39
  declare function daysDifference(date1: Date, date2: Date): number;
71
-
40
+ //#endregion
41
+ //#region src/debounce.d.ts
72
42
  /**
73
- * URL utility functions
74
- */
75
- /**
76
- * Parse query parameters from URL
77
- */
78
- declare function parseQueryParams(url: string): Record<string, string>;
79
- /**
80
- * Build query string from object
81
- */
82
- declare function buildQueryString(params: Record<string, unknown>): string;
83
- /**
84
- * Get domain from URL
85
- */
86
- declare function getDomain(url: string): string;
87
- /**
88
- * Get pathname from URL
89
- */
90
- declare function getPathname(url: string): string;
91
- /**
92
- * Validate URL
93
- */
94
- declare function isValidUrl(url: string): boolean;
95
- /**
96
- * Combine URL parts
43
+ * Debounce utility
97
44
  */
98
- declare function combineUrl(base: string, ...paths: string[]): string;
99
-
45
+ declare function debounce<T extends (...args: unknown[]) => unknown>(func: T, waitMs: number): (...args: Parameters<T>) => void;
46
+ //#endregion
47
+ //#region src/hash.d.ts
100
48
  /**
101
49
  * Hashing utility functions
102
50
  */
@@ -112,32 +60,24 @@ declare function hashString(str: string): string;
112
60
  * Generate a deterministic ID from multiple values
113
61
  */
114
62
  declare function generateId(...values: (string | number)[]): string;
115
-
63
+ //#endregion
64
+ //#region src/retry.d.ts
116
65
  /**
117
66
  * Retry utility with exponential backoff
118
67
  */
119
68
  interface RetryOptions {
120
- maxAttempts?: number;
121
- delayMs?: number;
122
- backoffMultiplier?: number;
123
- maxDelayMs?: number;
124
- onRetry?: (error: Error, attempt: number) => void;
69
+ maxAttempts?: number;
70
+ delayMs?: number;
71
+ backoffMultiplier?: number;
72
+ maxDelayMs?: number;
73
+ onRetry?: (error: Error, attempt: number) => void;
125
74
  }
126
75
  /**
127
76
  * Retry a function with exponential backoff
128
77
  */
129
78
  declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
130
-
131
- /**
132
- * Debounce utility
133
- */
134
- declare function debounce<T extends (...args: any[]) => any>(func: T, waitMs: number): (...args: Parameters<T>) => void;
135
-
136
- /**
137
- * Throttle utility
138
- */
139
- declare function throttle<T extends (...args: any[]) => any>(func: T, limitMs: number): (...args: Parameters<T>) => void;
140
-
79
+ //#endregion
80
+ //#region src/storage.d.ts
141
81
  /**
142
82
  * Storage utility functions for browser localStorage/sessionStorage
143
83
  */
@@ -145,43 +85,112 @@ declare function throttle<T extends (...args: any[]) => any>(func: T, limitMs: n
145
85
  * Safe localStorage wrapper
146
86
  */
147
87
  declare const storage: {
148
- /**
149
- * Get item from localStorage with JSON parsing
150
- */
151
- get<T>(key: string, defaultValue?: T): T | null;
152
- /**
153
- * Set item in localStorage with JSON stringification
154
- */
155
- set<T>(key: string, value: T): void;
156
- /**
157
- * Remove item from localStorage
158
- */
159
- remove(key: string): void;
160
- /**
161
- * Clear all localStorage
162
- */
163
- clear(): void;
88
+ /**
89
+ * Get item from localStorage with JSON parsing
90
+ */
91
+ get<T>(key: string, defaultValue?: T): T | null;
92
+ /**
93
+ * Set item in localStorage with JSON stringification
94
+ */
95
+ set<T>(key: string, value: T): void;
96
+ /**
97
+ * Remove item from localStorage
98
+ */
99
+ remove(key: string): void;
100
+ /**
101
+ * Clear all localStorage
102
+ */
103
+ clear(): void;
164
104
  };
165
105
  /**
166
106
  * Safe sessionStorage wrapper
167
107
  */
168
108
  declare const sessionStorage: {
169
- /**
170
- * Get item from sessionStorage with JSON parsing
171
- */
172
- get<T>(key: string, defaultValue?: T): T | null;
173
- /**
174
- * Set item in sessionStorage with JSON stringification
175
- */
176
- set<T>(key: string, value: T): void;
177
- /**
178
- * Remove item from sessionStorage
179
- */
180
- remove(key: string): void;
181
- /**
182
- * Clear all sessionStorage
183
- */
184
- clear(): void;
109
+ /**
110
+ * Get item from sessionStorage with JSON parsing
111
+ */
112
+ get<T>(key: string, defaultValue?: T): T | null;
113
+ /**
114
+ * Set item in sessionStorage with JSON stringification
115
+ */
116
+ set<T>(key: string, value: T): void;
117
+ /**
118
+ * Remove item from sessionStorage
119
+ */
120
+ remove(key: string): void;
121
+ /**
122
+ * Clear all sessionStorage
123
+ */
124
+ clear(): void;
185
125
  };
186
-
187
- export { type RetryOptions, addDays, buildQueryString, capitalize, combineUrl, daysDifference, debounce, endOfDay, generateId, getDomain, getLastNDays, getPathname, hashString, isToday, isValidUrl, parseQueryParams, randomString, retry, sessionStorage, simpleHash, slugify, startOfDay, storage, throttle, toCamelCase, toDateString, toISOString, toKebabCase, toSnakeCase, truncate };
126
+ //#endregion
127
+ //#region src/string.d.ts
128
+ /**
129
+ * String utility functions
130
+ */
131
+ /**
132
+ * Truncate a string to a maximum length
133
+ */
134
+ declare function truncate(str: string, maxLength: number, suffix?: string): string;
135
+ /**
136
+ * Capitalize the first letter of a string
137
+ */
138
+ declare function capitalize(str: string): string;
139
+ /**
140
+ * Convert string to kebab-case
141
+ */
142
+ declare function toKebabCase(str: string): string;
143
+ /**
144
+ * Convert string to camelCase
145
+ */
146
+ declare function toCamelCase(str: string): string;
147
+ /**
148
+ * Convert string to snake_case
149
+ */
150
+ declare function toSnakeCase(str: string): string;
151
+ /**
152
+ * Generate a random alphanumeric string
153
+ */
154
+ declare function randomString(length: number): string;
155
+ /**
156
+ * Slugify a string for URLs
157
+ */
158
+ declare function slugify(str: string): string;
159
+ //#endregion
160
+ //#region src/throttle.d.ts
161
+ /**
162
+ * Throttle utility
163
+ */
164
+ declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limitMs: number): (...args: Parameters<T>) => void;
165
+ //#endregion
166
+ //#region src/url.d.ts
167
+ /**
168
+ * URL utility functions
169
+ */
170
+ /**
171
+ * Parse query parameters from URL
172
+ */
173
+ declare function parseQueryParams(url: string): Record<string, string>;
174
+ /**
175
+ * Build query string from object
176
+ */
177
+ declare function buildQueryString(params: Record<string, unknown>): string;
178
+ /**
179
+ * Get domain from URL
180
+ */
181
+ declare function getDomain(url: string): string;
182
+ /**
183
+ * Get pathname from URL
184
+ */
185
+ declare function getPathname(url: string): string;
186
+ /**
187
+ * Validate URL
188
+ */
189
+ declare function isValidUrl(url: string): boolean;
190
+ /**
191
+ * Combine URL parts
192
+ */
193
+ declare function combineUrl(base: string, ...paths: string[]): string;
194
+ //#endregion
195
+ export { RetryOptions, addDays, buildQueryString, capitalize, combineUrl, daysDifference, debounce, endOfDay, generateId, getDomain, getLastNDays, getPathname, hashString, isToday, isValidUrl, parseQueryParams, randomString, retry, sessionStorage, simpleHash, slugify, startOfDay, storage, throttle, toCamelCase, toDateString, toISOString, toKebabCase, toSnakeCase, truncate };
196
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/date.ts","../src/debounce.ts","../src/hash.ts","../src/retry.ts","../src/storage.ts","../src/string.ts","../src/throttle.ts","../src/url.ts"],"mappings":";;AAOA;;;;AAAwD;iBAAxC,WAAA,CAAY,IAA4B,EAAtB,IAAI;;;;iBAOtB,YAAA,CAAa,IAA4B,EAAtB,IAAI;AAWvC;;;AAAA,iBAAgB,YAAA,CAAa,CAAA;EAAc,SAAA,EAAW,IAAA;EAAM,OAAA,EAAS,IAAI;AAAA;;;;iBAUzD,OAAA,CAAQ,IAA4B,EAAtB,IAAI;AAAlC;;;AAAA,iBASgB,OAAA,CAAQ,IAAA,EAAM,IAAA,EAAM,IAAA,WAAe,IAAI;AATH;AASpD;;AAToD,iBAkBpC,UAAA,CAAW,IAAA,EAAM,IAAA,GAAO,IAAI;;;;iBAS5B,QAAA,CAAS,IAAA,EAAM,IAAA,GAAO,IAAI;;;AAlBa;iBA2BvC,cAAA,CAAe,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAI;;;;AAhEvD;;iBCH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D;iBOAxC,gBAAA,CAAiB,GAAA,WAAc,MAAM;;;;iBAYrC,gBAAA,CAAiB,MAA+B,EAAvB,MAAM;APM/C;;;AAAA,iBOsBgB,SAAA,CAAU,GAAW;;;;iBAYrB,WAAA,CAAY,GAAW;;;APlCkC;iBO8CzD,UAAA,CAAW,GAAW;;;;iBAYtB,UAAA,CAAW,IAAA,aAAiB,KAAK"}
package/dist/index.d.ts CHANGED
@@ -1,35 +1,4 @@
1
- /**
2
- * String utility functions
3
- */
4
- /**
5
- * Truncate a string to a maximum length
6
- */
7
- declare function truncate(str: string, maxLength: number, suffix?: string): string;
8
- /**
9
- * Capitalize the first letter of a string
10
- */
11
- declare function capitalize(str: string): string;
12
- /**
13
- * Convert string to kebab-case
14
- */
15
- declare function toKebabCase(str: string): string;
16
- /**
17
- * Convert string to camelCase
18
- */
19
- declare function toCamelCase(str: string): string;
20
- /**
21
- * Convert string to snake_case
22
- */
23
- declare function toSnakeCase(str: string): string;
24
- /**
25
- * Generate a random alphanumeric string
26
- */
27
- declare function randomString(length: number): string;
28
- /**
29
- * Slugify a string for URLs
30
- */
31
- declare function slugify(str: string): string;
32
-
1
+ //#region src/date.d.ts
33
2
  /**
34
3
  * Date utility functions
35
4
  */
@@ -45,8 +14,8 @@ declare function toDateString(date: Date | string | number): string;
45
14
  * Get date range for the last N days
46
15
  */
47
16
  declare function getLastNDays(n: number): {
48
- startDate: Date;
49
- endDate: Date;
17
+ startDate: Date;
18
+ endDate: Date;
50
19
  };
51
20
  /**
52
21
  * Check if a date is today
@@ -68,35 +37,14 @@ declare function endOfDay(date: Date): Date;
68
37
  * Get difference in days between two dates
69
38
  */
70
39
  declare function daysDifference(date1: Date, date2: Date): number;
71
-
40
+ //#endregion
41
+ //#region src/debounce.d.ts
72
42
  /**
73
- * URL utility functions
74
- */
75
- /**
76
- * Parse query parameters from URL
77
- */
78
- declare function parseQueryParams(url: string): Record<string, string>;
79
- /**
80
- * Build query string from object
81
- */
82
- declare function buildQueryString(params: Record<string, unknown>): string;
83
- /**
84
- * Get domain from URL
85
- */
86
- declare function getDomain(url: string): string;
87
- /**
88
- * Get pathname from URL
89
- */
90
- declare function getPathname(url: string): string;
91
- /**
92
- * Validate URL
93
- */
94
- declare function isValidUrl(url: string): boolean;
95
- /**
96
- * Combine URL parts
43
+ * Debounce utility
97
44
  */
98
- declare function combineUrl(base: string, ...paths: string[]): string;
99
-
45
+ declare function debounce<T extends (...args: unknown[]) => unknown>(func: T, waitMs: number): (...args: Parameters<T>) => void;
46
+ //#endregion
47
+ //#region src/hash.d.ts
100
48
  /**
101
49
  * Hashing utility functions
102
50
  */
@@ -112,32 +60,24 @@ declare function hashString(str: string): string;
112
60
  * Generate a deterministic ID from multiple values
113
61
  */
114
62
  declare function generateId(...values: (string | number)[]): string;
115
-
63
+ //#endregion
64
+ //#region src/retry.d.ts
116
65
  /**
117
66
  * Retry utility with exponential backoff
118
67
  */
119
68
  interface RetryOptions {
120
- maxAttempts?: number;
121
- delayMs?: number;
122
- backoffMultiplier?: number;
123
- maxDelayMs?: number;
124
- onRetry?: (error: Error, attempt: number) => void;
69
+ maxAttempts?: number;
70
+ delayMs?: number;
71
+ backoffMultiplier?: number;
72
+ maxDelayMs?: number;
73
+ onRetry?: (error: Error, attempt: number) => void;
125
74
  }
126
75
  /**
127
76
  * Retry a function with exponential backoff
128
77
  */
129
78
  declare function retry<T>(fn: () => Promise<T>, options?: RetryOptions): Promise<T>;
130
-
131
- /**
132
- * Debounce utility
133
- */
134
- declare function debounce<T extends (...args: any[]) => any>(func: T, waitMs: number): (...args: Parameters<T>) => void;
135
-
136
- /**
137
- * Throttle utility
138
- */
139
- declare function throttle<T extends (...args: any[]) => any>(func: T, limitMs: number): (...args: Parameters<T>) => void;
140
-
79
+ //#endregion
80
+ //#region src/storage.d.ts
141
81
  /**
142
82
  * Storage utility functions for browser localStorage/sessionStorage
143
83
  */
@@ -145,43 +85,112 @@ declare function throttle<T extends (...args: any[]) => any>(func: T, limitMs: n
145
85
  * Safe localStorage wrapper
146
86
  */
147
87
  declare const storage: {
148
- /**
149
- * Get item from localStorage with JSON parsing
150
- */
151
- get<T>(key: string, defaultValue?: T): T | null;
152
- /**
153
- * Set item in localStorage with JSON stringification
154
- */
155
- set<T>(key: string, value: T): void;
156
- /**
157
- * Remove item from localStorage
158
- */
159
- remove(key: string): void;
160
- /**
161
- * Clear all localStorage
162
- */
163
- clear(): void;
88
+ /**
89
+ * Get item from localStorage with JSON parsing
90
+ */
91
+ get<T>(key: string, defaultValue?: T): T | null;
92
+ /**
93
+ * Set item in localStorage with JSON stringification
94
+ */
95
+ set<T>(key: string, value: T): void;
96
+ /**
97
+ * Remove item from localStorage
98
+ */
99
+ remove(key: string): void;
100
+ /**
101
+ * Clear all localStorage
102
+ */
103
+ clear(): void;
164
104
  };
165
105
  /**
166
106
  * Safe sessionStorage wrapper
167
107
  */
168
108
  declare const sessionStorage: {
169
- /**
170
- * Get item from sessionStorage with JSON parsing
171
- */
172
- get<T>(key: string, defaultValue?: T): T | null;
173
- /**
174
- * Set item in sessionStorage with JSON stringification
175
- */
176
- set<T>(key: string, value: T): void;
177
- /**
178
- * Remove item from sessionStorage
179
- */
180
- remove(key: string): void;
181
- /**
182
- * Clear all sessionStorage
183
- */
184
- clear(): void;
109
+ /**
110
+ * Get item from sessionStorage with JSON parsing
111
+ */
112
+ get<T>(key: string, defaultValue?: T): T | null;
113
+ /**
114
+ * Set item in sessionStorage with JSON stringification
115
+ */
116
+ set<T>(key: string, value: T): void;
117
+ /**
118
+ * Remove item from sessionStorage
119
+ */
120
+ remove(key: string): void;
121
+ /**
122
+ * Clear all sessionStorage
123
+ */
124
+ clear(): void;
185
125
  };
186
-
187
- export { type RetryOptions, addDays, buildQueryString, capitalize, combineUrl, daysDifference, debounce, endOfDay, generateId, getDomain, getLastNDays, getPathname, hashString, isToday, isValidUrl, parseQueryParams, randomString, retry, sessionStorage, simpleHash, slugify, startOfDay, storage, throttle, toCamelCase, toDateString, toISOString, toKebabCase, toSnakeCase, truncate };
126
+ //#endregion
127
+ //#region src/string.d.ts
128
+ /**
129
+ * String utility functions
130
+ */
131
+ /**
132
+ * Truncate a string to a maximum length
133
+ */
134
+ declare function truncate(str: string, maxLength: number, suffix?: string): string;
135
+ /**
136
+ * Capitalize the first letter of a string
137
+ */
138
+ declare function capitalize(str: string): string;
139
+ /**
140
+ * Convert string to kebab-case
141
+ */
142
+ declare function toKebabCase(str: string): string;
143
+ /**
144
+ * Convert string to camelCase
145
+ */
146
+ declare function toCamelCase(str: string): string;
147
+ /**
148
+ * Convert string to snake_case
149
+ */
150
+ declare function toSnakeCase(str: string): string;
151
+ /**
152
+ * Generate a random alphanumeric string
153
+ */
154
+ declare function randomString(length: number): string;
155
+ /**
156
+ * Slugify a string for URLs
157
+ */
158
+ declare function slugify(str: string): string;
159
+ //#endregion
160
+ //#region src/throttle.d.ts
161
+ /**
162
+ * Throttle utility
163
+ */
164
+ declare function throttle<T extends (...args: unknown[]) => unknown>(func: T, limitMs: number): (...args: Parameters<T>) => void;
165
+ //#endregion
166
+ //#region src/url.d.ts
167
+ /**
168
+ * URL utility functions
169
+ */
170
+ /**
171
+ * Parse query parameters from URL
172
+ */
173
+ declare function parseQueryParams(url: string): Record<string, string>;
174
+ /**
175
+ * Build query string from object
176
+ */
177
+ declare function buildQueryString(params: Record<string, unknown>): string;
178
+ /**
179
+ * Get domain from URL
180
+ */
181
+ declare function getDomain(url: string): string;
182
+ /**
183
+ * Get pathname from URL
184
+ */
185
+ declare function getPathname(url: string): string;
186
+ /**
187
+ * Validate URL
188
+ */
189
+ declare function isValidUrl(url: string): boolean;
190
+ /**
191
+ * Combine URL parts
192
+ */
193
+ declare function combineUrl(base: string, ...paths: string[]): string;
194
+ //#endregion
195
+ export { RetryOptions, addDays, buildQueryString, capitalize, combineUrl, daysDifference, debounce, endOfDay, generateId, getDomain, getLastNDays, getPathname, hashString, isToday, isValidUrl, parseQueryParams, randomString, retry, sessionStorage, simpleHash, slugify, startOfDay, storage, throttle, toCamelCase, toDateString, toISOString, toKebabCase, toSnakeCase, truncate };
196
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/date.ts","../src/debounce.ts","../src/hash.ts","../src/retry.ts","../src/storage.ts","../src/string.ts","../src/throttle.ts","../src/url.ts"],"mappings":";;AAOA;;;;AAAwD;iBAAxC,WAAA,CAAY,IAA4B,EAAtB,IAAI;;;;iBAOtB,YAAA,CAAa,IAA4B,EAAtB,IAAI;AAWvC;;;AAAA,iBAAgB,YAAA,CAAa,CAAA;EAAc,SAAA,EAAW,IAAA;EAAM,OAAA,EAAS,IAAI;AAAA;;;;iBAUzD,OAAA,CAAQ,IAA4B,EAAtB,IAAI;AAAlC;;;AAAA,iBASgB,OAAA,CAAQ,IAAA,EAAM,IAAA,EAAM,IAAA,WAAe,IAAI;AATH;AASpD;;AAToD,iBAkBpC,UAAA,CAAW,IAAA,EAAM,IAAA,GAAO,IAAI;;;;iBAS5B,QAAA,CAAS,IAAA,EAAM,IAAA,GAAO,IAAI;;;AAlBa;iBA2BvC,cAAA,CAAe,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAI;;;;AAhEvD;;iBCHgB,QAAA,eAAuB,IAAA,wBAAA,CACrC,IAAA,EAAM,CAAA,EACN,MAAA,eACK,IAAA,EAAM,UAAA,CAAW,CAAA;;;;ADAxB;;;;AAAwD;iBEAxC,UAAA,CAAW,GAAW;;;;iBAatB,UAAA,CAAW,GAAW;AFKtC;;;AAAA,iBEEgB,UAAA,CAAA,GAAc,MAAM;;;;AFpBpC;;UGHiB,YAAA;EACf,WAAA;EACA,OAAA;EACA,iBAAA;EACA,UAAA;EACA,OAAA,IAAW,KAAA,EAAO,KAAK,EAAE,OAAA;AAAA;AHK8B;AAWzD;;AAXyD,iBGCnC,KAAA,GAAA,CAAS,EAAA,QAAU,OAAA,CAAQ,CAAA,GAAI,OAAA,GAAS,YAAA,GAAoB,OAAA,C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