UNPKG

@cainiaofe/cn-utils

Version:

菜鸟前端基础工具库

27 lines (26 loc) 916 B
import { TLanguage } from '@cainiaofe/cn-i18n'; import { I18nNumber } from './number'; export type DecimalSeparator = '.' | ','; export type GroupSeparator = '.' | ',' | ' ' | ''; export type Numeric = number | string; export interface NumSysConf { decimalSeparator?: DecimalSeparator; groupSeparator?: GroupSeparator; groupSize?: number; secondaryGroupSize?: number; fractionGroupSeparator?: GroupSeparator; fractionGroupSize?: number; } export type NumberCompactValue = { value: string; parts: { value: string; compact: string; }; }; export type NumberCompactByConValue = { compact: string; value: I18nNumber; }; export type NumberCompact = (num: Numeric, lang?: TLanguage, options?: Intl.NumberFormatOptions) => NumberCompactValue | null; export type NumberCompactByCon = (num: Numeric, conversion: number, lang?: TLanguage) => NumberCompactByConValue;