@takentrade/takentrade-libs
Version:
TakeNTrade shared libraries
70 lines (69 loc) • 2.05 kB
TypeScript
/**
* Formats currency (Naira)
* 1234.56 → ₦1,234.56
*/
export declare const formatCurrency: (amount: number, currency?: string, decimals?: number) => string;
/**
* Formats currency without symbol
* 1234.56 → 1,234.56
*/
export declare const formatAmount: (amount: number, decimals?: number) => string;
/**
* Formats account number for display
* 0123456789 → 0123 4567 89
*/
export declare const formatAccountNumber: (accountNumber: string) => string;
/**
* Masks account number for security
* 0123456789 → ****6789
*/
export declare const maskAccountNumber: (accountNumber: string) => string;
/**
* Masks email for security
* user@example.com → u***@example.com
*/
export declare const maskEmail: (email: string) => string;
/**
* Formats date to Nigerian format
* 2024-01-15 → 15/01/2024
*/
export declare const formatDate: (date: Date | string) => string;
/**
* Formats date and time
* → 15/01/2024 14:30
*/
export declare const formatDateTime: (date: Date | string) => string;
/**
* Formats relative time
* → "2 hours ago", "3 days ago"
*/
export declare const formatRelativeTime: (date: Date | string) => string;
/**
* Formats percentage
* 0.025 → 2.5%
*/
export declare const formatPercentage: (value: number, decimals?: number) => string;
/**
* Formats file size
* 1536 → 1.5 KB
*/
export declare const formatFileSize: (bytes: number) => string;
/**
* Truncates text with ellipsis
* "Long text here" → "Long te..."
*/
export declare const truncateText: (text: string, maxLength: number) => string;
/**
* Capitalizes first letter of each word
* "john doe" → "John Doe"
*/
export declare const toTitleCase: (text: string) => string;
/**
* Formats transaction status for display
*/
/**
* Normalizes a phone number to the international format for Nigeria (234...)
* Handles formats like '0803...', '803...', '+234803...'
*/
export declare function toSmsSafeNigerianPhone(phone: string | number): string;
export declare const formatTransactionStatus: (status: string) => string;