UNPKG

@kodex-data/prototypes

Version:

A library of TypeScript prototypes that extend built-in types in JavaScript, providing additional functionality to make development easier and more efficient. This library includes prototypes for working with big numbers, Ethereum Virtual Machine (EVM) fu

34 lines (33 loc) 1.63 kB
declare global { interface Date { /** * Returns an array of strings representing the days of the specified month and year. * Each string in the array has the format "DD-dayName", where "DD" is the day of the month and "dayName" is the name of the day (e.g. "01-Sun"). */ getDaysArray(year?: number, month?: number): string[]; /** Formats a date object as a string in the format "YYYY-MM-DD". */ formatMMDDYYYY(): string; /** Returns the time part of a Date object in the format "HH:MM:SS" or "HH:MM:SS:MS" if addMS is true. */ formatHHMMSS(addMs?: boolean): string; formatMMDDYYYY_HHMMSS(): string; /** Returns the Unix timestamp (number of seconds since January 1, 1970) rounded up to the nearest second. */ unix(): number; } interface String { /** Returns a promise that resolves after a given number of milliseconds. */ sleep(): Promise<void>; /** Converts a Unix timestamp to a date string in the format "MM/DD/YYYY HH:MM:SS". */ ts2date(): string; /** Converts a number of seconds to a human-readable string in the format "X units". */ sec2read(): string; } interface Number { /** Returns a promise that resolves after a given number of milliseconds. */ sleep(): Promise<void>; /** Converts a Unix timestamp to a date string in the format "MM/DD/YYYY HH:MM:SS". */ ts2date(): string; /** Converts a number of seconds to a human-readable string in the format "X units". */ sec2read(): string; } } export {};