/** * @private * NOTE: can't use this in the exported methods because it wouldn't work when importing aliases! */ interface HybridJSUtilsSettings { SPRINTF_NEEDLE: string; } export declare class HybridJSUtils { static set settings(newValue: HybridJSUtilsSettings); static get settings(): HybridJSUtilsSettings; static defaults: HybridJSUtilsSettings; static get version(): string; private static _settings; static addLeadingZeroes(numeric: number | string): string; /** * Alias for forEachFrom, see forEachFrom */ static eachFrom(array: T[], index: number, iteratee: (item: T, index: number, source: T[]) => any): T[]; /** * Loop over arrays starting from desired index * @param array: the list to iterate * @param index: the starting index * @param iteratee: the function to invoke in each iteration * * @returns The array */ static forEachFrom(array: T[], index: number, iteratee: (item: T, index: number, source: T[]) => any): T[]; /** * * @param duration value in milliseconds to wait for * @param updateFreq value in milliseconds to refresh * @param targetEl a DOM element where the countdown will be appended * * @returns Promise with last value for counter, to check if everything went ok. */ static htmlCountDown(duration: number, updateFreq: number, targetEl: HTMLElement): Promise; static isClient(): boolean; /** * Checks if value is primitive * @param value * @return boolean */ static isPrimitive(value: any): boolean; /** * Produce a formatted style in console. * @param title title of the log * @param msg text of the log * @param style CSS string defining the style */ static logWithStyle(title: string, msg: string, style?: string): void; /** * Check if a string is numeric * @param value */ static isNumeric(value: string): boolean; /** * Check wether a value is strictly an Object * @param entity */ static isObject(entity: any): boolean; /** * Transform object keys to camelCase recursively * @param source */ static objectKeysToCamelCase(source: { [key: string]: any; }): { [key: string]: any; }; /** * Generate a random hex string * @param length */ static randomHex(length: number): string; /** * Generate a random int in the range provided * @param min * @param max * @param excludeMin * @param excludeMax */ static randomInt(min: number, max: number, excludeMin?: boolean | string, excludeMax?: boolean | string): number; /** * Generate a random numeric string of the given length * @param length */ static randomNumericString(length?: number): string; static removeMultipleSpaces(source: string): string; static removeTrailingSlash(source: string): string; static resetSettings(): void; /** * Round number with a certain precision * @param value * @param decimalDigits decimal digits wanted, defaults to 2 */ static roundNumber(value: number | string, decimalDigits?: number): number; /** * Replace values in strings where the placeholder (default is %s) is found * @param str the source string * @param argv the parameters */ static sprintf(str: string, ...argv: (string | number)[]): string; /** * Like sprintf, but allows a custom needle * @param str * @param needle * @param argv */ static sprintfx(str: string, needle: string, ...argv: (string | number)[]): string; /** * Remove Emojis from string * @param s */ static stripEmojis(s: string): string; static toCamelCase(s: string): string; static toKebabCase(s: string): string; static toPascalCase(s: string): string; static toSnakeCase(s: string): string; static toUpperSnakeCase(s: string): string; static words(string: string, pattern?: RegExp): string[]; } export declare const isClient: typeof HybridJSUtils.isClient; export declare const htmlCountDown: typeof HybridJSUtils.htmlCountDown; export declare const logWithStyle: typeof HybridJSUtils.logWithStyle; export declare const addLeadingZeroes: typeof HybridJSUtils.addLeadingZeroes; export declare const eachFrom: typeof HybridJSUtils.eachFrom; export declare const forEachFrom: typeof HybridJSUtils.forEachFrom; export declare const isNumeric: typeof HybridJSUtils.isNumeric; export declare const isObject: typeof HybridJSUtils.isObject; export declare const objectKeysToCamelCase: typeof HybridJSUtils.objectKeysToCamelCase; export declare const randomHex: typeof HybridJSUtils.randomHex; export declare const randomInt: typeof HybridJSUtils.randomInt; export declare const randomNumericString: typeof HybridJSUtils.randomNumericString; export declare const removeMultipleSpaces: typeof HybridJSUtils.removeMultipleSpaces; export declare const removeTrailingSlash: typeof HybridJSUtils.removeTrailingSlash; export declare const roundNumber: typeof HybridJSUtils.roundNumber; export declare const sprintf: typeof HybridJSUtils.sprintf; export declare const sprintfx: typeof HybridJSUtils.sprintfx; export declare const toCamelCase: typeof HybridJSUtils.toCamelCase; export declare const toSnakeCase: typeof HybridJSUtils.toSnakeCase; export {};