@rxxuzi/gumi
Version:
Clean & minimal design system with delightful interactions
65 lines (64 loc) • 1.81 kB
TypeScript
/**
* Debounce function
*/
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
/**
* Throttle function
*/
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
/**
* Deep merge objects
*/
export declare function deepMerge<T extends Record<string, any>>(target: T, ...sources: Partial<T>[]): T;
/**
* Check if value is object
*/
export declare function isObject(item: any): item is Record<string, any>;
/**
* Generate unique ID
*/
export declare function generateId(prefix?: string): string;
/**
* Format number with commas
*/
export declare function formatNumber(num: number): string;
/**
* Clamp number between min and max
*/
export declare function clamp(num: number, min: number, max: number): number;
/**
* Get cookie value
*/
export declare function getCookie(name: string): string | null;
/**
* Set cookie
*/
export declare function setCookie(name: string, value: string, days?: number): void;
/**
* Remove cookie
*/
export declare function removeCookie(name: string): void;
/**
* Copy text to clipboard
*/
export declare function copyToClipboard(text: string): Promise<boolean>;
/**
* Parse JSON safely
*/
export declare function parseJSON<T = any>(json: string, fallback?: T): T | undefined;
/**
* Format date
*/
export declare function formatDate(date: Date | string | number, format?: string): string;
/**
* Get query string parameter
*/
export declare function getQueryParam(name: string): string | null;
/**
* Set query string parameter
*/
export declare function setQueryParam(name: string, value: string): void;
/**
* Remove query string parameter
*/
export declare function removeQueryParam(name: string): void;