UNPKG

digit-to-words-nepali

Version:

A comprehensive TypeScript library for converting numbers to words in English and Nepali languages. Supports numbers up to 10^39 (Adanta Singhar), currency formatting, decimal handling with individual digit pronunciation, and BigInt. Zero dependencies, fu

45 lines (44 loc) 1.09 kB
/** * Cache utility for storing conversion results to improve performance * for repeated conversions of the same numbers. */ import { ConversionResult } from '../types/converterTypes'; type CacheKey = { value: string; lang: string; isCurrency: boolean; includeDecimal: boolean; individualDecimalDigits?: boolean; currency?: string; decimalSuffix?: string; currencyDecimalSuffix?: string; }; /** * LRU Cache for conversion results */ export declare class ConversionCache { private cache; private readonly maxSize; constructor(maxSize?: number); /** * Get cached result, implementing LRU behavior. */ get(key: CacheKey): ConversionResult | undefined; /** * Set cached result, evicting oldest if necessary. */ set(key: CacheKey, result: ConversionResult): void; /** * Clear all cached entries. */ clear(): void; /** * Get current cache size. */ get size(): number; } /** * Global singleton cache instance */ export declare const conversionCache: ConversionCache; export {};