@cute-dw/core
Version:
This TypeScript library is the main part of a more powerfull package designed for the fast WEB software development. The cornerstone of the library is the **DataStore** class, which might be useful when you need a full control of the data, but do not need
55 lines (54 loc) • 2.05 kB
TypeScript
import { Locale } from "../Locale";
/**
* This utility class consists exclusively of the static methods that operate on numeric values with localization taking into account
* @since 0.4.0
* @license MIT, (c) 2022 ALEXANDER STRELKOV, alv.strelkov@gmail.com
*/
export declare class NumberSpeller {
/**
*
* @param amount
* @param thousandGroup
* @param words
* @param options
* @returns
*/
private static _digitGroup;
/**
* Converts an integer value in words
* @param value A number to convert
* @param options An object containing certain properties and their values
* @returns String
* @static
*/
static spellInteger(value: number, options?: {
locale?: string | Locale;
}): string;
/**
* Converts amount of money in words
* @param value Sum to convert
* @param options Configuration object
* @returns String
* @throws Error if the _locale_ value is invalid in `options`
* @static
*/
static spellCurrency(value: number, options?: {
currency?: string;
locale?: string | Locale;
fractionAsNumber?: boolean;
}): string;
/**
* Gets the result of the specified _unit_ formatting
* @param value A value in units
* @param unit Required value in unit formatting. Possible values are [core unit identifiers](https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier) that was selected for use in ECMAScript. Pairs of simple units can be concatenated with "-per-" to make a compound unit.
* @param options Configuration object
* @returns String
* @throws Error if the _locale_ value is invalid in `options`
* @static
*/
static spellUnit(value: number, unit: string, options?: {
locale?: string | Locale;
unitDisplay?: "long" | "short" | "narrow";
valueAsNumber?: boolean;
}): string;
}