helpers.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930
  1. export declare const formatDate: (date: Date | string) => string;
  2. export declare const formatDateTime: (date: Date | string) => string;
  3. export declare const formatTimestamp: (timestamp: number) => string;
  4. export declare const getCurrentTimestamp: () => number;
  5. export declare const getCurrentDateTime: () => string;
  6. export declare const getTimeDifferenceInSeconds: (date1: Date | string, date2: Date | string) => number;
  7. export declare const getTimeDifferenceInMinutes: (date1: Date | string, date2: Date | string) => number;
  8. export declare const getTimeDifferenceInHours: (date1: Date | string, date2: Date | string) => number;
  9. export declare const getTimeDifferenceInDays: (date1: Date | string, date2: Date | string) => number;
  10. export declare const getDateDaysAgo: (days: number) => Date;
  11. export declare const getDateHoursAgo: (hours: number) => Date;
  12. export declare const getDateMinutesAgo: (minutes: number) => Date;
  13. export declare const generateId: () => string;
  14. export declare const deepClone: <T>(obj: T) => T;
  15. export declare const sleep: (ms: number) => Promise<void>;
  16. export declare const retry: <T>(fn: () => Promise<T>, maxAttempts?: number, delayMs?: number) => Promise<T>;
  17. export declare const isValidIpAddress: (ip: string) => boolean;
  18. export declare const isValidMqttTopic: (topic: string) => boolean;
  19. export declare const formatBytes: (bytes: number, decimals?: number) => string;
  20. export declare const generateRandomColor: () => string;
  21. export declare const limitArrayLength: <T>(array: T[], maxLength: number) => T[];
  22. export declare const paginate: <T>(items: T[], page?: number, pageSize?: number) => {
  23. items: T[];
  24. totalPages: number;
  25. currentPage: number;
  26. hasNext: boolean;
  27. hasPrev: boolean;
  28. };
  29. export declare const toString: (value: string | string[] | any | any[] | undefined) => string;
  30. //# sourceMappingURL=helpers.d.ts.map