UNPKG

jsm-utilities

Version:
57 lines (56 loc) 2.76 kB
/** * @description Uses lodash flatten to split a string by , / ; + * @param str string to split * @returns {string[]} */ export declare const splitString: (str: string, use_plus_character?: boolean) => string[]; export declare const stringToBoolean: (str: string) => boolean; export declare const addLeadingZeros: (num: number, totalLength: number) => string; export declare const toPriceAmount: (str: string) => number; export declare const isNumeric: (val: string) => boolean; export declare const abbreviateNumber: (n: number) => string; export declare const createBigram: (word: string) => string[]; export declare const checkSimilarity: (a: string, b: string) => number; export declare const generateStringNgrams: (str: string) => string[]; export declare const formatBytes: (bytes: number, decimals?: number) => string; export declare const generateSlug: (title: string) => Promise<string>; export declare const toSnakeCase: (str: string) => string; export declare const toKebabCase: (input: string) => string; export declare function capitalizeFirstLetter(str: string): string; export declare function kebabToCamel(kebabString: string): string; export declare function camelToKebab(camelCaseString: string): string; export declare function camelToWords(camelCaseString: string): string; export declare function pluralize(word: string): string; export declare function singularize(word: string): string; export declare function replaceAll(input: string, search: string, replace: string): string; export declare function buildUserFullName(names: { first_name?: string | null; family_name?: string | null; }): string; export declare const formatAmount: (x: number, separator?: string, decimals?: number) => string; export declare const formatNotificationSpace: (space: string, infos: { user?: string; company?: string | null; office?: string; store?: string; role?: string; }) => string | null; /** * @description Generate a random 4-digit pin code between 1000 and 9999 (inclusive) * @returns {string} a random 4-digit pin code */ export declare function generatePinCode(): string; /** * Function to get a substring from position 0 to the first whitespace after threshold characters * @param str - The input string * @param threshold - The threshold number of characters * @returns - The extracted substring */ export declare function getSubstringUntilFirstWhitespaceAfterNChars(str: string, threshold?: number, dots?: string): string; /** * @generator Jsm * @author dr. Salmi <reevosolutions@gmail.com> * @since 23-07-2024 08:43:03 */ export declare function generateItemAlphabetCode(usedCodes: string[]): string; export declare function countCharacterOccurrenceInString(str: string, character: string): number;