UNPKG

dop-stick

Version:

Source control tooling for versionable-upgradeable smart contracts

50 lines 1.78 kB
/** * Utility function to pause execution for a specified duration * @param ms Duration to sleep in milliseconds * @returns Promise that resolves after the specified duration */ export declare function sleep(ms: number): Promise<void>; /** * Formats a duration in milliseconds to a human-readable string * @param ms Duration in milliseconds * @returns Formatted duration string */ export declare function formatDuration(ms: number): string; /** * Checks if a value is defined (not null or undefined) * @param value Value to check * @returns Boolean indicating if the value is defined */ export declare function isDefined<T>(value: T | null | undefined): value is T; /** * Safely stringifies a value, handling circular references * @param value Value to stringify * @returns String representation of the value */ export declare function safeStringify(value: unknown): string; /** * Ensures a string ends with a specific suffix * @param str String to check * @param suffix Suffix to ensure * @returns String with the suffix */ export declare function ensureSuffix(str: string, suffix: string): string; /** * Formats a number with commas for better readability * @param num Number to format * @returns Formatted number string */ export declare function formatNumber(value: number | string | bigint): string; /** * Truncates a string with ellipsis in the middle * @param str String to truncate * @param maxLength Maximum length of the output string * @returns Truncated string */ export declare function truncateMiddle(str: string, maxLength: number): string; export declare const utils: { formatDuration: typeof formatDuration; formatNumber: typeof formatNumber; truncateMiddle: typeof truncateMiddle; }; //# sourceMappingURL=common.d.ts.map