| Total Complexity | 0 |
| Complexity/F | 0 |
| Lines of Code | 33 |
| Function Count | 0 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | /* |
||
| 2 | * decimal.js-i18n v0.2.6 |
||
| 3 | * Full internationalization support for decimal.js. |
||
| 4 | * MIT License |
||
| 5 | * Copyright (c) 2022 Pedro José Batista <[email protected]> |
||
| 6 | * https://github.com/pjbatista/decimal.js-i18n |
||
| 7 | */ |
||
| 8 | import type FormatPartTypes from "./partTypes"; |
||
| 9 | |||
| 10 | // Filters: |
||
| 11 | 1 | export const decimals = <T extends PartType>({ type }: T) => type === "decimal"; |
|
| 12 | 82723 | export const exponents = <T extends PartType>({ type: t }: T) => t === "exponentInteger" || t === "exponentMinusSign"; |
|
| 13 | 82723 | export const fractions = <T extends PartType>({ type }: T) => type === "fraction"; |
|
| 14 | 83084 | export const integerGroups = <T extends PartType>({ type }: T) => type === "integer" || type === "group"; |
|
| 15 | 61984 | export const integers = <T extends PartType>({ type }: T) => type === "integer"; |
|
| 16 | |||
| 17 | /** Object used to describe a single transliteration part of `Decimal.Format.formatToParts`. */ |
||
| 18 | export type FormatPart = PartType & PartValue; |
||
| 19 | |||
| 20 | /** Fragment of a part containing the type. */ |
||
| 21 | export interface PartType { |
||
| 22 | /** A string describing the formatting part. */ |
||
| 23 | type: Intl.NumberFormatPartTypes | FormatPartTypes; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** Fragment of a part containing the value. */ |
||
| 27 | export interface PartValue { |
||
| 28 | /** Localized string with a fragment of the result. */ |
||
| 29 | value: string; |
||
| 30 | } |
||
| 31 | |||
| 32 | export default FormatPart; |
||
| 33 |