alapa
Version:
A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.
42 lines (41 loc) • 1.43 kB
TypeScript
import { LogMessageType } from "./types";
export declare const randomMd5: () => string;
export declare const randomNumber: (len?: number) => string;
export declare const md5: (data: string) => string;
/**
* Logs a message to a specified text file.
* @param message - The message to log.
* @param filePath - The path to the text file where the message should be logged.
*/
export declare function logToFile(message: string, type?: LogMessageType, filePath?: string): void;
export declare const toAbsolutePath: (...paths: string[]) => string;
export declare const escapeRegex: (str: string) => string;
export declare const loadYaml: (filePath: string) => any;
/**
* A utility function that converts a given value to a number, removing any non-numeric characters except for a decimal point.
* It handles cases with multiple decimal points, null, undefined, or empty strings, and returns 0 in those cases.
*
* @param {any} value - The input value to be converted to a number.
* @returns {number} - The numeric value derived from the input, or 0 if the input is invalid.
*
* @example
* // Returns 123456.78
* NumberOnly('123abc456.78xyz');
*
* @example
* // Returns 12.3456
* NumberOnly('12.34.56');
*
* @example
* // Returns 0
* NumberOnly('abc');
*
* @example
* // Returns 0
* NumberOnly(null);
*
* @example
* // Returns 0
* NumberOnly('');
*/
export declare function toNumberOnly(value: any): number;