@formatjs/ecma402-abstract 1.11.8 → 1.11.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/262.ts +372 -0
- package/BUILD +97 -0
- package/CHANGELOG.md +709 -0
- package/CanonicalizeLocaleList.ts +8 -0
- package/CanonicalizeTimeZoneName.ts +29 -0
- package/CoerceOptionsToObject.ts +13 -0
- package/DefaultNumberOption.ts +28 -0
- package/GetNumberOption.ts +29 -0
- package/GetOption.ts +38 -0
- package/GetOptionsObject.ts +14 -0
- package/IsSanctionedSimpleUnitIdentifier.ts +66 -0
- package/IsValidTimeZoneName.ts +27 -0
- package/IsWellFormedCurrencyCode.ts +23 -0
- package/IsWellFormedUnitIdentifier.ts +32 -0
- package/LICENSE.md +0 -0
- package/NumberFormat/ComputeExponent.ts +49 -0
- package/NumberFormat/ComputeExponentForMagnitude.ts +71 -0
- package/NumberFormat/CurrencyDigits.ts +13 -0
- package/NumberFormat/FormatNumericToParts.ts +22 -0
- package/NumberFormat/FormatNumericToString.ts +71 -0
- package/NumberFormat/InitializeNumberFormat.ts +147 -0
- package/NumberFormat/PartitionNumberPattern.ts +86 -0
- package/NumberFormat/SetNumberFormatDigitOptions.ts +45 -0
- package/NumberFormat/SetNumberFormatUnitOptions.ts +77 -0
- package/NumberFormat/ToRawFixed.ts +56 -0
- package/NumberFormat/ToRawPrecision.ts +86 -0
- package/NumberFormat/digit-mapping.generated.ts +1 -0
- package/NumberFormat/format_to_parts.ts +571 -0
- package/PartitionPattern.ts +38 -0
- package/README.md +0 -0
- package/SupportedLocales.ts +31 -0
- package/data.ts +9 -0
- package/index.ts +45 -0
- package/package.json +3 -3
- package/regex.generated.ts +2 -0
- package/scripts/digit-mapping.ts +109 -0
- package/scripts/regex-gen.ts +19 -0
- package/tests/PartitionPattern.test.ts +38 -0
- package/tests/ToRawFixed.test.tsx +41 -0
- package/tests/ToRawPrecision.test.tsx +65 -0
- package/tsconfig.json +5 -0
- package/types/core.ts +11 -0
- package/types/date-time.ts +199 -0
- package/types/displaynames.ts +48 -0
- package/types/list.ts +22 -0
- package/types/number.ts +240 -0
- package/types/plural-rules.ts +18 -0
- package/types/relative-time.ts +74 -0
- package/utils.ts +128 -0
- package/262.d.ts +0 -92
- package/262.d.ts.map +0 -1
- package/262.js +0 -362
- package/CanonicalizeLocaleList.d.ts +0 -6
- package/CanonicalizeLocaleList.d.ts.map +0 -1
- package/CanonicalizeLocaleList.js +0 -12
- package/CanonicalizeTimeZoneName.d.ts +0 -9
- package/CanonicalizeTimeZoneName.d.ts.map +0 -1
- package/CanonicalizeTimeZoneName.js +0 -21
- package/CoerceOptionsToObject.d.ts +0 -7
- package/CoerceOptionsToObject.d.ts.map +0 -1
- package/CoerceOptionsToObject.js +0 -16
- package/DefaultNumberOption.d.ts +0 -9
- package/DefaultNumberOption.d.ts.map +0 -1
- package/DefaultNumberOption.js +0 -14
- package/GetNumberOption.d.ts +0 -10
- package/GetNumberOption.d.ts.map +0 -1
- package/GetNumberOption.js +0 -18
- package/GetOption.d.ts +0 -10
- package/GetOption.d.ts.map +0 -1
- package/GetOption.js +0 -35
- package/GetOptionsObject.d.ts +0 -7
- package/GetOptionsObject.d.ts.map +0 -1
- package/GetOptionsObject.js +0 -18
- package/IsSanctionedSimpleUnitIdentifier.d.ts +0 -14
- package/IsSanctionedSimpleUnitIdentifier.d.ts.map +0 -1
- package/IsSanctionedSimpleUnitIdentifier.js +0 -68
- package/IsValidTimeZoneName.d.ts +0 -10
- package/IsValidTimeZoneName.d.ts.map +0 -1
- package/IsValidTimeZoneName.js +0 -23
- package/IsWellFormedCurrencyCode.d.ts +0 -5
- package/IsWellFormedCurrencyCode.d.ts.map +0 -1
- package/IsWellFormedCurrencyCode.js +0 -25
- package/IsWellFormedUnitIdentifier.d.ts +0 -6
- package/IsWellFormedUnitIdentifier.d.ts.map +0 -1
- package/IsWellFormedUnitIdentifier.js +0 -32
- package/NumberFormat/ComputeExponent.d.ts +0 -12
- package/NumberFormat/ComputeExponent.d.ts.map +0 -1
- package/NumberFormat/ComputeExponent.js +0 -43
- package/NumberFormat/ComputeExponentForMagnitude.d.ts +0 -10
- package/NumberFormat/ComputeExponentForMagnitude.d.ts.map +0 -1
- package/NumberFormat/ComputeExponentForMagnitude.js +0 -64
- package/NumberFormat/CurrencyDigits.d.ts +0 -7
- package/NumberFormat/CurrencyDigits.d.ts.map +0 -1
- package/NumberFormat/CurrencyDigits.js +0 -14
- package/NumberFormat/FormatNumericToParts.d.ts +0 -5
- package/NumberFormat/FormatNumericToParts.d.ts.map +0 -1
- package/NumberFormat/FormatNumericToParts.js +0 -18
- package/NumberFormat/FormatNumericToString.d.ts +0 -9
- package/NumberFormat/FormatNumericToString.d.ts.map +0 -1
- package/NumberFormat/FormatNumericToString.js +0 -45
- package/NumberFormat/InitializeNumberFormat.d.ts +0 -13
- package/NumberFormat/InitializeNumberFormat.d.ts.map +0 -1
- package/NumberFormat/InitializeNumberFormat.js +0 -68
- package/NumberFormat/PartitionNumberPattern.d.ts +0 -8
- package/NumberFormat/PartitionNumberPattern.d.ts.map +0 -1
- package/NumberFormat/PartitionNumberPattern.js +0 -80
- package/NumberFormat/SetNumberFormatDigitOptions.d.ts +0 -6
- package/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +0 -1
- package/NumberFormat/SetNumberFormatDigitOptions.js +0 -40
- package/NumberFormat/SetNumberFormatUnitOptions.d.ts +0 -8
- package/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +0 -1
- package/NumberFormat/SetNumberFormatUnitOptions.js +0 -43
- package/NumberFormat/ToRawFixed.d.ts +0 -10
- package/NumberFormat/ToRawFixed.d.ts.map +0 -1
- package/NumberFormat/ToRawFixed.js +0 -55
- package/NumberFormat/ToRawPrecision.d.ts +0 -3
- package/NumberFormat/ToRawPrecision.d.ts.map +0 -1
- package/NumberFormat/ToRawPrecision.js +0 -78
- package/NumberFormat/digit-mapping.generated.d.ts +0 -2
- package/NumberFormat/digit-mapping.generated.d.ts.map +0 -1
- package/NumberFormat/digit-mapping.generated.js +0 -4
- package/NumberFormat/format_to_parts.d.ts +0 -22
- package/NumberFormat/format_to_parts.d.ts.map +0 -1
- package/NumberFormat/format_to_parts.js +0 -424
- package/PartitionPattern.d.ts +0 -9
- package/PartitionPattern.d.ts.map +0 -1
- package/PartitionPattern.js +0 -39
- package/SupportedLocales.d.ts +0 -10
- package/SupportedLocales.d.ts.map +0 -1
- package/SupportedLocales.js +0 -24
- package/data.d.ts +0 -6
- package/data.d.ts.map +0 -1
- package/data.js +0 -17
- package/index.d.ts +0 -37
- package/index.d.ts.map +0 -1
- package/index.js +0 -48
- package/lib/262.d.ts +0 -92
- package/lib/262.d.ts.map +0 -1
- package/lib/262.js +0 -336
- package/lib/CanonicalizeLocaleList.d.ts +0 -6
- package/lib/CanonicalizeLocaleList.d.ts.map +0 -1
- package/lib/CanonicalizeLocaleList.js +0 -8
- package/lib/CanonicalizeTimeZoneName.d.ts +0 -9
- package/lib/CanonicalizeTimeZoneName.d.ts.map +0 -1
- package/lib/CanonicalizeTimeZoneName.js +0 -17
- package/lib/CoerceOptionsToObject.d.ts +0 -7
- package/lib/CoerceOptionsToObject.d.ts.map +0 -1
- package/lib/CoerceOptionsToObject.js +0 -12
- package/lib/DefaultNumberOption.d.ts +0 -9
- package/lib/DefaultNumberOption.d.ts.map +0 -1
- package/lib/DefaultNumberOption.js +0 -10
- package/lib/GetNumberOption.d.ts +0 -10
- package/lib/GetNumberOption.d.ts.map +0 -1
- package/lib/GetNumberOption.js +0 -14
- package/lib/GetOption.d.ts +0 -10
- package/lib/GetOption.d.ts.map +0 -1
- package/lib/GetOption.js +0 -31
- package/lib/GetOptionsObject.d.ts +0 -7
- package/lib/GetOptionsObject.d.ts.map +0 -1
- package/lib/GetOptionsObject.js +0 -14
- package/lib/IsSanctionedSimpleUnitIdentifier.d.ts +0 -14
- package/lib/IsSanctionedSimpleUnitIdentifier.d.ts.map +0 -1
- package/lib/IsSanctionedSimpleUnitIdentifier.js +0 -63
- package/lib/IsValidTimeZoneName.d.ts +0 -10
- package/lib/IsValidTimeZoneName.d.ts.map +0 -1
- package/lib/IsValidTimeZoneName.js +0 -19
- package/lib/IsWellFormedCurrencyCode.d.ts +0 -5
- package/lib/IsWellFormedCurrencyCode.d.ts.map +0 -1
- package/lib/IsWellFormedCurrencyCode.js +0 -21
- package/lib/IsWellFormedUnitIdentifier.d.ts +0 -6
- package/lib/IsWellFormedUnitIdentifier.d.ts.map +0 -1
- package/lib/IsWellFormedUnitIdentifier.js +0 -28
- package/lib/NumberFormat/ComputeExponent.d.ts +0 -12
- package/lib/NumberFormat/ComputeExponent.d.ts.map +0 -1
- package/lib/NumberFormat/ComputeExponent.js +0 -39
- package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts +0 -10
- package/lib/NumberFormat/ComputeExponentForMagnitude.d.ts.map +0 -1
- package/lib/NumberFormat/ComputeExponentForMagnitude.js +0 -60
- package/lib/NumberFormat/CurrencyDigits.d.ts +0 -7
- package/lib/NumberFormat/CurrencyDigits.d.ts.map +0 -1
- package/lib/NumberFormat/CurrencyDigits.js +0 -10
- package/lib/NumberFormat/FormatNumericToParts.d.ts +0 -5
- package/lib/NumberFormat/FormatNumericToParts.d.ts.map +0 -1
- package/lib/NumberFormat/FormatNumericToParts.js +0 -14
- package/lib/NumberFormat/FormatNumericToString.d.ts +0 -9
- package/lib/NumberFormat/FormatNumericToString.d.ts.map +0 -1
- package/lib/NumberFormat/FormatNumericToString.js +0 -41
- package/lib/NumberFormat/InitializeNumberFormat.d.ts +0 -13
- package/lib/NumberFormat/InitializeNumberFormat.d.ts.map +0 -1
- package/lib/NumberFormat/InitializeNumberFormat.js +0 -64
- package/lib/NumberFormat/PartitionNumberPattern.d.ts +0 -8
- package/lib/NumberFormat/PartitionNumberPattern.d.ts.map +0 -1
- package/lib/NumberFormat/PartitionNumberPattern.js +0 -75
- package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts +0 -6
- package/lib/NumberFormat/SetNumberFormatDigitOptions.d.ts.map +0 -1
- package/lib/NumberFormat/SetNumberFormatDigitOptions.js +0 -36
- package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts +0 -8
- package/lib/NumberFormat/SetNumberFormatUnitOptions.d.ts.map +0 -1
- package/lib/NumberFormat/SetNumberFormatUnitOptions.js +0 -39
- package/lib/NumberFormat/ToRawFixed.d.ts +0 -10
- package/lib/NumberFormat/ToRawFixed.d.ts.map +0 -1
- package/lib/NumberFormat/ToRawFixed.js +0 -51
- package/lib/NumberFormat/ToRawPrecision.d.ts +0 -3
- package/lib/NumberFormat/ToRawPrecision.d.ts.map +0 -1
- package/lib/NumberFormat/ToRawPrecision.js +0 -74
- package/lib/NumberFormat/digit-mapping.generated.d.ts +0 -2
- package/lib/NumberFormat/digit-mapping.generated.d.ts.map +0 -1
- package/lib/NumberFormat/digit-mapping.generated.js +0 -1
- package/lib/NumberFormat/format_to_parts.d.ts +0 -22
- package/lib/NumberFormat/format_to_parts.d.ts.map +0 -1
- package/lib/NumberFormat/format_to_parts.js +0 -421
- package/lib/PartitionPattern.d.ts +0 -9
- package/lib/PartitionPattern.d.ts.map +0 -1
- package/lib/PartitionPattern.js +0 -35
- package/lib/SupportedLocales.d.ts +0 -10
- package/lib/SupportedLocales.d.ts.map +0 -1
- package/lib/SupportedLocales.js +0 -20
- package/lib/data.d.ts +0 -6
- package/lib/data.d.ts.map +0 -1
- package/lib/data.js +0 -13
- package/lib/index.d.ts +0 -37
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -34
- package/lib/regex.generated.d.ts +0 -2
- package/lib/regex.generated.d.ts.map +0 -1
- package/lib/regex.generated.js +0 -2
- package/lib/types/core.d.ts +0 -11
- package/lib/types/core.d.ts.map +0 -1
- package/lib/types/core.js +0 -1
- package/lib/types/date-time.d.ts +0 -135
- package/lib/types/date-time.d.ts.map +0 -1
- package/lib/types/date-time.js +0 -6
- package/lib/types/displaynames.d.ts +0 -47
- package/lib/types/displaynames.d.ts.map +0 -1
- package/lib/types/displaynames.js +0 -1
- package/lib/types/list.d.ts +0 -19
- package/lib/types/list.d.ts.map +0 -1
- package/lib/types/list.js +0 -1
- package/lib/types/number.d.ts +0 -147
- package/lib/types/number.d.ts.map +0 -1
- package/lib/types/number.js +0 -1
- package/lib/types/plural-rules.d.ts +0 -17
- package/lib/types/plural-rules.d.ts.map +0 -1
- package/lib/types/plural-rules.js +0 -1
- package/lib/types/relative-time.d.ts +0 -41
- package/lib/types/relative-time.d.ts.map +0 -1
- package/lib/types/relative-time.js +0 -1
- package/lib/utils.d.ts +0 -24
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -78
- package/regex.generated.d.ts +0 -2
- package/regex.generated.d.ts.map +0 -1
- package/regex.generated.js +0 -5
- package/types/core.d.ts +0 -11
- package/types/core.d.ts.map +0 -1
- package/types/core.js +0 -2
- package/types/date-time.d.ts +0 -135
- package/types/date-time.d.ts.map +0 -1
- package/types/date-time.js +0 -9
- package/types/displaynames.d.ts +0 -47
- package/types/displaynames.d.ts.map +0 -1
- package/types/displaynames.js +0 -2
- package/types/list.d.ts +0 -19
- package/types/list.d.ts.map +0 -1
- package/types/list.js +0 -2
- package/types/number.d.ts +0 -147
- package/types/number.d.ts.map +0 -1
- package/types/number.js +0 -2
- package/types/plural-rules.d.ts +0 -17
- package/types/plural-rules.d.ts.map +0 -1
- package/types/plural-rules.js +0 -2
- package/types/relative-time.d.ts +0 -41
- package/types/relative-time.d.ts.map +0 -1
- package/types/relative-time.js +0 -2
- package/utils.d.ts +0 -24
- package/utils.d.ts.map +0 -1
- package/utils.js +0 -90
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formatjs/ecma402-abstract",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.9",
|
|
4
4
|
"description": "A collection of implementation for ECMAScript abstract operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"format"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@formatjs/intl-localematcher": "0.2.
|
|
17
|
+
"@formatjs/intl-localematcher": "0.2.29",
|
|
18
18
|
"tslib": "2.4.0"
|
|
19
19
|
},
|
|
20
20
|
"author": "Long Ho <holevietlong@gmail.com",
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
"homepage": "https://github.com/formatjs/formatjs",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"gitHead": "a7842673d8ad205171ad7c8cb8bb2f318b427c0c"
|
|
35
|
-
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @generated from regex-gen.ts
|
|
2
|
+
export const S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import minimist, {ParsedArgs} from 'minimist'
|
|
2
|
+
import {outputFileSync} from 'fs-extra'
|
|
3
|
+
|
|
4
|
+
// Generate an array of 10 characters with consecutive codepoint, starting from `starCharCode`.
|
|
5
|
+
function generateDigitChars(startCharCode: number): string[] {
|
|
6
|
+
const arr = new Array<string>(10)
|
|
7
|
+
for (let i = 0; i < 10; i++) {
|
|
8
|
+
arr[i] = String.fromCodePoint(startCharCode + i)
|
|
9
|
+
}
|
|
10
|
+
return arr
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// https://tc39.es/ecma402/#table-numbering-system-digits
|
|
14
|
+
const digitMapping: Record<string, string[]> = {
|
|
15
|
+
adlm: generateDigitChars(0x1e950),
|
|
16
|
+
ahom: generateDigitChars(0x11730),
|
|
17
|
+
arab: generateDigitChars(0x660),
|
|
18
|
+
arabext: generateDigitChars(0x6f0),
|
|
19
|
+
bali: generateDigitChars(0x1b50),
|
|
20
|
+
beng: generateDigitChars(0x9e6),
|
|
21
|
+
bhks: generateDigitChars(0x11c50),
|
|
22
|
+
brah: generateDigitChars(0x11066),
|
|
23
|
+
cakm: generateDigitChars(0x11136),
|
|
24
|
+
cham: generateDigitChars(0xaa50),
|
|
25
|
+
deva: generateDigitChars(0x966),
|
|
26
|
+
diak: generateDigitChars(0x11950),
|
|
27
|
+
fullwide: generateDigitChars(0xff10),
|
|
28
|
+
gong: generateDigitChars(0x11da0),
|
|
29
|
+
gonm: generateDigitChars(0x11d50),
|
|
30
|
+
gujr: generateDigitChars(0xae6),
|
|
31
|
+
guru: generateDigitChars(0xa66),
|
|
32
|
+
hanidec: [
|
|
33
|
+
'\u3007',
|
|
34
|
+
'\u4e00',
|
|
35
|
+
'\u4e8c',
|
|
36
|
+
'\u4e09',
|
|
37
|
+
'\u56db',
|
|
38
|
+
'\u4e94',
|
|
39
|
+
'\u516d',
|
|
40
|
+
'\u4e03',
|
|
41
|
+
'\u516b',
|
|
42
|
+
'\u4e5d',
|
|
43
|
+
],
|
|
44
|
+
hmng: generateDigitChars(0x16b50),
|
|
45
|
+
hmnp: generateDigitChars(0x1e140),
|
|
46
|
+
java: generateDigitChars(0xa9d0),
|
|
47
|
+
kali: generateDigitChars(0xa900),
|
|
48
|
+
khmr: generateDigitChars(0x17e0),
|
|
49
|
+
knda: generateDigitChars(0xce6),
|
|
50
|
+
lana: generateDigitChars(0x1a80),
|
|
51
|
+
lanatham: generateDigitChars(0x1a90),
|
|
52
|
+
laoo: generateDigitChars(0xed0),
|
|
53
|
+
lepc: generateDigitChars(0x1a90),
|
|
54
|
+
limb: generateDigitChars(0x1946),
|
|
55
|
+
mathbold: generateDigitChars(0x1d7ce),
|
|
56
|
+
mathdbl: generateDigitChars(0x1d7d8),
|
|
57
|
+
mathmono: generateDigitChars(0x1d7f6),
|
|
58
|
+
mathsanb: generateDigitChars(0x1d7ec),
|
|
59
|
+
mathsans: generateDigitChars(0x1d7e2),
|
|
60
|
+
mlym: generateDigitChars(0xd66),
|
|
61
|
+
modi: generateDigitChars(0x11650),
|
|
62
|
+
mong: generateDigitChars(0x1810),
|
|
63
|
+
mroo: generateDigitChars(0x16a60),
|
|
64
|
+
mtei: generateDigitChars(0xabf0),
|
|
65
|
+
mymr: generateDigitChars(0x1040),
|
|
66
|
+
mymrshan: generateDigitChars(0x1090),
|
|
67
|
+
mymrtlng: generateDigitChars(0xa9f0),
|
|
68
|
+
newa: generateDigitChars(0x11450),
|
|
69
|
+
nkoo: generateDigitChars(0x07c0),
|
|
70
|
+
olck: generateDigitChars(0x1c50),
|
|
71
|
+
orya: generateDigitChars(0xb66),
|
|
72
|
+
osma: generateDigitChars(0x104a0),
|
|
73
|
+
rohg: generateDigitChars(0x10d30),
|
|
74
|
+
saur: generateDigitChars(0xa8d0),
|
|
75
|
+
segment: generateDigitChars(0x1fbf0),
|
|
76
|
+
shrd: generateDigitChars(0x111d0),
|
|
77
|
+
sind: generateDigitChars(0x112f0),
|
|
78
|
+
sinh: generateDigitChars(0x0de6),
|
|
79
|
+
sora: generateDigitChars(0x110f0),
|
|
80
|
+
sund: generateDigitChars(0x1bb0),
|
|
81
|
+
takr: generateDigitChars(0x116c0),
|
|
82
|
+
talu: generateDigitChars(0x19d0),
|
|
83
|
+
tamldec: generateDigitChars(0xbe6),
|
|
84
|
+
telu: generateDigitChars(0xc66),
|
|
85
|
+
thai: generateDigitChars(0xe50),
|
|
86
|
+
tibt: generateDigitChars(0xf20),
|
|
87
|
+
tirh: generateDigitChars(0x114d0),
|
|
88
|
+
vaii: generateDigitChars(0x1620),
|
|
89
|
+
wara: generateDigitChars(0x118e0),
|
|
90
|
+
wcho: generateDigitChars(0x1e2f0),
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface Args extends ParsedArgs {
|
|
94
|
+
out: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function main(args: Args) {
|
|
98
|
+
const {out} = args
|
|
99
|
+
outputFileSync(
|
|
100
|
+
out,
|
|
101
|
+
`export const digitMapping: Record<string, ReadonlyArray<string>> = ${JSON.stringify(
|
|
102
|
+
digitMapping
|
|
103
|
+
)};`
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (require.main === module) {
|
|
108
|
+
main(minimist<Args>(process.argv))
|
|
109
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import regenerate from 'regenerate'
|
|
2
|
+
import {outputFileSync} from 'fs-extra'
|
|
3
|
+
import minimist from 'minimist'
|
|
4
|
+
|
|
5
|
+
function main(args: minimist.ParsedArgs) {
|
|
6
|
+
const symbolSeparator = regenerate().add(
|
|
7
|
+
require('@unicode/unicode-13.0.0/General_Category/Symbol/code-points.js')
|
|
8
|
+
)
|
|
9
|
+
outputFileSync(
|
|
10
|
+
args.out,
|
|
11
|
+
`// @generated from regex-gen.ts
|
|
12
|
+
export const S_UNICODE_REGEX = /${symbolSeparator.toString()}/
|
|
13
|
+
`
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (require.main === module) {
|
|
18
|
+
main(minimist(process.argv))
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {PartitionPattern} from '../PartitionPattern'
|
|
2
|
+
|
|
3
|
+
test('PartitionPattern should partition pattern correctly', function () {
|
|
4
|
+
expect(PartitionPattern('AA{0}BB')).toEqual([
|
|
5
|
+
{
|
|
6
|
+
type: 'literal',
|
|
7
|
+
value: 'AA',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: '0',
|
|
11
|
+
value: undefined,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'literal',
|
|
15
|
+
value: 'BB',
|
|
16
|
+
},
|
|
17
|
+
])
|
|
18
|
+
expect(PartitionPattern('{0} BB')).toEqual([
|
|
19
|
+
{
|
|
20
|
+
type: '0',
|
|
21
|
+
value: undefined,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: 'literal',
|
|
25
|
+
value: ' BB',
|
|
26
|
+
},
|
|
27
|
+
])
|
|
28
|
+
expect(PartitionPattern('AA {0}')).toEqual([
|
|
29
|
+
{
|
|
30
|
+
type: 'literal',
|
|
31
|
+
value: 'AA ',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
type: '0',
|
|
35
|
+
value: undefined,
|
|
36
|
+
},
|
|
37
|
+
])
|
|
38
|
+
})
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {ToRawFixed} from '../NumberFormat/ToRawFixed'
|
|
2
|
+
|
|
3
|
+
test('ToRawFixed(9.99, 0, 1)', () => {
|
|
4
|
+
expect(ToRawFixed(9.99, 0, 1)).toEqual({
|
|
5
|
+
formattedString: '10',
|
|
6
|
+
roundedNumber: 10,
|
|
7
|
+
integerDigitsCount: 2,
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('ToRawFixed(1e41, 0, 3)', () => {
|
|
12
|
+
expect(ToRawFixed(1e41, 0, 3)).toEqual({
|
|
13
|
+
formattedString: '100000000000000000000000000000000000000000',
|
|
14
|
+
roundedNumber: 1e41,
|
|
15
|
+
integerDigitsCount: 42,
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
test('ToRawFixed(1e-10, 1, 21)', () => {
|
|
20
|
+
expect(ToRawFixed(1e-10, 1, 21)).toEqual({
|
|
21
|
+
formattedString: '0.0000000001',
|
|
22
|
+
roundedNumber: 1e-10,
|
|
23
|
+
integerDigitsCount: 1,
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('Rounding: ToRawFixed(123.445, 0, 2)', () => {
|
|
28
|
+
expect(ToRawFixed(123.445, 0, 2)).toEqual({
|
|
29
|
+
formattedString: '123.45',
|
|
30
|
+
roundedNumber: 123.45,
|
|
31
|
+
integerDigitsCount: 3,
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('ToRawFixed(1.2344501e+34, 1, 3)', () => {
|
|
36
|
+
expect(ToRawFixed(1.2344501e34, 1, 3)).toEqual({
|
|
37
|
+
formattedString: '12344501000000000000000000000000000.0',
|
|
38
|
+
roundedNumber: 1.2344501e34,
|
|
39
|
+
integerDigitsCount: 35,
|
|
40
|
+
})
|
|
41
|
+
})
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {ToRawPrecision} from '../NumberFormat/ToRawPrecision'
|
|
2
|
+
|
|
3
|
+
it('ToRawPrecision(9.99, 1, 2)', () => {
|
|
4
|
+
expect(ToRawPrecision(9.99, 1, 2)).toEqual({
|
|
5
|
+
formattedString: '10',
|
|
6
|
+
roundedNumber: 10,
|
|
7
|
+
integerDigitsCount: 2,
|
|
8
|
+
})
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('ToRawPrecision(9.95, 1, 2)', () => {
|
|
12
|
+
expect(ToRawPrecision(9.95, 1, 2)).toEqual({
|
|
13
|
+
formattedString: '10',
|
|
14
|
+
roundedNumber: 10,
|
|
15
|
+
integerDigitsCount: 2,
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('ToRawPrecision(9.94, 1, 2)', () => {
|
|
20
|
+
expect(ToRawPrecision(9.94, 1, 2)).toEqual({
|
|
21
|
+
formattedString: '9.9',
|
|
22
|
+
roundedNumber: 9.9,
|
|
23
|
+
integerDigitsCount: 1,
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('ToRawPrecision(1e41, 1, 21)', () => {
|
|
28
|
+
expect(ToRawPrecision(1e41, 1, 21)).toEqual({
|
|
29
|
+
formattedString: '100000000000000000000000000000000000000000',
|
|
30
|
+
roundedNumber: 1e41,
|
|
31
|
+
integerDigitsCount: 42,
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('toRawPrecison(1e-10, 1, 21)', () => {
|
|
36
|
+
expect(ToRawPrecision(1e-10, 1, 21)).toEqual({
|
|
37
|
+
formattedString: '0.0000000001',
|
|
38
|
+
roundedNumber: 1e-10,
|
|
39
|
+
integerDigitsCount: 1,
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('ToRawPrecision(1e21, 1, 10)', () => {
|
|
44
|
+
expect(ToRawPrecision(1e21, 1, 10)).toEqual({
|
|
45
|
+
formattedString: '1000000000000000000000',
|
|
46
|
+
roundedNumber: 1e21,
|
|
47
|
+
integerDigitsCount: 22,
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('Rounding: ToRawPrecision(123.445, 3, 5)', () => {
|
|
52
|
+
expect(ToRawPrecision(123.445, 3, 5)).toEqual({
|
|
53
|
+
formattedString: '123.45',
|
|
54
|
+
roundedNumber: 123.45,
|
|
55
|
+
integerDigitsCount: 3,
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
it('ToRawPrecision(1.1, 3, 5)', () => {
|
|
60
|
+
expect(ToRawPrecision(1.1, 3, 5)).toEqual({
|
|
61
|
+
formattedString: '1.10',
|
|
62
|
+
roundedNumber: 1.1,
|
|
63
|
+
integerDigitsCount: 1,
|
|
64
|
+
})
|
|
65
|
+
})
|
package/tsconfig.json
ADDED
package/types/core.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
export type Formats = Pick<
|
|
2
|
+
Intl.DateTimeFormatOptions,
|
|
3
|
+
| 'weekday'
|
|
4
|
+
| 'era'
|
|
5
|
+
| 'year'
|
|
6
|
+
| 'month'
|
|
7
|
+
| 'day'
|
|
8
|
+
| 'hour'
|
|
9
|
+
| 'minute'
|
|
10
|
+
| 'second'
|
|
11
|
+
| 'timeZoneName'
|
|
12
|
+
> & {
|
|
13
|
+
fractionalSecondDigits?: 0 | 1 | 2
|
|
14
|
+
hour12?: boolean
|
|
15
|
+
pattern: string
|
|
16
|
+
pattern12: string
|
|
17
|
+
skeleton: string
|
|
18
|
+
rawPattern: string
|
|
19
|
+
rangePatterns: Record<TABLE_2 | 'default', RangePatterns>
|
|
20
|
+
rangePatterns12: Record<TABLE_2 | 'default', RangePatterns>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface IntlDateTimeFormatInternal {
|
|
24
|
+
locale: string
|
|
25
|
+
dataLocale: string
|
|
26
|
+
calendar?: string
|
|
27
|
+
dateStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
28
|
+
timeStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
29
|
+
weekday: 'narrow' | 'short' | 'long'
|
|
30
|
+
era: 'narrow' | 'short' | 'long'
|
|
31
|
+
year: '2-digit' | 'numeric'
|
|
32
|
+
month: '2-digit' | 'numeric' | 'narrow' | 'short' | 'long'
|
|
33
|
+
day: '2-digit' | 'numeric'
|
|
34
|
+
dayPeriod: 'narrow' | 'short' | 'long'
|
|
35
|
+
hour: '2-digit' | 'numeric'
|
|
36
|
+
minute: '2-digit' | 'numeric'
|
|
37
|
+
second: '2-digit' | 'numeric'
|
|
38
|
+
timeZoneName: 'short' | 'long'
|
|
39
|
+
fractionalSecondDigits?: 1 | 2 | 3
|
|
40
|
+
hourCycle: string
|
|
41
|
+
numberingSystem: string
|
|
42
|
+
timeZone: string
|
|
43
|
+
pattern: string
|
|
44
|
+
format: Formats
|
|
45
|
+
rangePatterns: Record<TABLE_2 | 'default', RangePatterns>
|
|
46
|
+
boundFormat?: Intl.DateTimeFormat['format']
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface RangePatternPart<
|
|
50
|
+
T extends RangePatternType = RangePatternType
|
|
51
|
+
> {
|
|
52
|
+
source: T
|
|
53
|
+
pattern: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type RangePatterns = Pick<
|
|
57
|
+
Intl.DateTimeFormatOptions,
|
|
58
|
+
| 'weekday'
|
|
59
|
+
| 'era'
|
|
60
|
+
| 'year'
|
|
61
|
+
| 'month'
|
|
62
|
+
| 'day'
|
|
63
|
+
| 'hour'
|
|
64
|
+
| 'minute'
|
|
65
|
+
| 'second'
|
|
66
|
+
| 'timeZoneName'
|
|
67
|
+
> & {
|
|
68
|
+
hour12?: boolean
|
|
69
|
+
patternParts: Array<RangePatternPart>
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export enum RangePatternType {
|
|
73
|
+
startRange = 'startRange',
|
|
74
|
+
shared = 'shared',
|
|
75
|
+
endRange = 'endRange',
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type TABLE_6 =
|
|
79
|
+
| 'weekday'
|
|
80
|
+
| 'era'
|
|
81
|
+
| 'year'
|
|
82
|
+
| 'month'
|
|
83
|
+
| 'day'
|
|
84
|
+
| 'hour'
|
|
85
|
+
| 'minute'
|
|
86
|
+
| 'second'
|
|
87
|
+
| 'fractionalSecondDigits'
|
|
88
|
+
| 'timeZoneName'
|
|
89
|
+
|
|
90
|
+
export type TABLE_2 =
|
|
91
|
+
| 'era'
|
|
92
|
+
| 'year'
|
|
93
|
+
| 'month'
|
|
94
|
+
| 'day'
|
|
95
|
+
| 'dayPeriod'
|
|
96
|
+
| 'ampm'
|
|
97
|
+
| 'hour'
|
|
98
|
+
| 'minute'
|
|
99
|
+
| 'second'
|
|
100
|
+
| 'fractionalSecondDigits'
|
|
101
|
+
|
|
102
|
+
export type TimeZoneNameData = Record<
|
|
103
|
+
string,
|
|
104
|
+
{
|
|
105
|
+
long?: [string, string]
|
|
106
|
+
short?: [string, string]
|
|
107
|
+
}
|
|
108
|
+
>
|
|
109
|
+
|
|
110
|
+
export interface EraData {
|
|
111
|
+
BC: string
|
|
112
|
+
AD: string
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface DateTimeFormatLocaleInternalData {
|
|
116
|
+
am: string
|
|
117
|
+
pm: string
|
|
118
|
+
weekday: {
|
|
119
|
+
narrow: string[]
|
|
120
|
+
long: string[]
|
|
121
|
+
short: string[]
|
|
122
|
+
}
|
|
123
|
+
era: {
|
|
124
|
+
narrow: EraData
|
|
125
|
+
long: EraData
|
|
126
|
+
short: EraData
|
|
127
|
+
}
|
|
128
|
+
month: {
|
|
129
|
+
narrow: string[]
|
|
130
|
+
long: string[]
|
|
131
|
+
short: string[]
|
|
132
|
+
}
|
|
133
|
+
timeZoneName: TimeZoneNameData
|
|
134
|
+
/**
|
|
135
|
+
* So we can construct GMT+08:00
|
|
136
|
+
*/
|
|
137
|
+
gmtFormat: string
|
|
138
|
+
/**
|
|
139
|
+
* So we can construct GMT+08:00
|
|
140
|
+
*/
|
|
141
|
+
hourFormat: string
|
|
142
|
+
hourCycle: string
|
|
143
|
+
dateFormat: {full: Formats; long: Formats; medium: Formats; short: Formats}
|
|
144
|
+
timeFormat: {full: Formats; long: Formats; medium: Formats; short: Formats}
|
|
145
|
+
dateTimeFormat: {full: string; long: string; medium: string; short: string}
|
|
146
|
+
formats: Record<string, Formats[]>
|
|
147
|
+
nu: string[]
|
|
148
|
+
hc: string[]
|
|
149
|
+
ca: string[]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export type IntervalFormatsData = {
|
|
153
|
+
intervalFormatFallback: string
|
|
154
|
+
} & Record<string, Record<string, string>>
|
|
155
|
+
|
|
156
|
+
export interface DateTimeFormat
|
|
157
|
+
extends Omit<
|
|
158
|
+
Intl.DateTimeFormat,
|
|
159
|
+
'resolvedOptions' | 'formatRange' | 'formatRangeToParts'
|
|
160
|
+
> {
|
|
161
|
+
resolvedOptions(): ResolvedDateTimeFormatOptions
|
|
162
|
+
formatRange(startDate: number | Date, endDate: number | Date): string
|
|
163
|
+
formatRangeToParts(
|
|
164
|
+
startDate: number | Date,
|
|
165
|
+
endDate: number | Date
|
|
166
|
+
): IntlDateTimeFormatPart[]
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface ResolvedDateTimeFormatOptions
|
|
170
|
+
extends Intl.ResolvedDateTimeFormatOptions {
|
|
171
|
+
dateStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
172
|
+
timeStyle?: 'full' | 'long' | 'medium' | 'short'
|
|
173
|
+
numberingSystem: string
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type UnpackedZoneData = [
|
|
177
|
+
// Seconds from UTC Time, -Infinity if NULL
|
|
178
|
+
number,
|
|
179
|
+
// abbrvs like EST/EDT
|
|
180
|
+
string,
|
|
181
|
+
// offsets in seconds
|
|
182
|
+
number,
|
|
183
|
+
// Whether it's daylight, 0|1
|
|
184
|
+
boolean
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
export type IntlDateTimeFormatPartType =
|
|
188
|
+
| Intl.DateTimeFormatPartTypes
|
|
189
|
+
| 'ampm'
|
|
190
|
+
| 'relatedYear'
|
|
191
|
+
| 'yearName'
|
|
192
|
+
| 'unknown'
|
|
193
|
+
| 'fractionalSecondDigits'
|
|
194
|
+
|
|
195
|
+
export interface IntlDateTimeFormatPart {
|
|
196
|
+
type: IntlDateTimeFormatPartType
|
|
197
|
+
value: string | undefined
|
|
198
|
+
source?: RangePatternType
|
|
199
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {LocaleData} from './core'
|
|
2
|
+
|
|
3
|
+
type LanguageTag = string
|
|
4
|
+
type RegionCode = string
|
|
5
|
+
type ScriptCode = string
|
|
6
|
+
type CurrencyCode = string
|
|
7
|
+
|
|
8
|
+
export interface DisplayNamesData {
|
|
9
|
+
/**
|
|
10
|
+
* Note that for style fields, `short` and `narrow` might not exist.
|
|
11
|
+
* At runtime, the fallback order will be narrow -> short -> long.
|
|
12
|
+
*/
|
|
13
|
+
types: {
|
|
14
|
+
/**
|
|
15
|
+
* Maps language subtag like `zh-CN` to their display names.
|
|
16
|
+
*/
|
|
17
|
+
language: {
|
|
18
|
+
narrow: Record<LanguageTag, string>
|
|
19
|
+
short: Record<LanguageTag, string>
|
|
20
|
+
long: Record<LanguageTag, string>
|
|
21
|
+
}
|
|
22
|
+
region: {
|
|
23
|
+
narrow: Record<RegionCode, string>
|
|
24
|
+
short: Record<RegionCode, string>
|
|
25
|
+
long: Record<RegionCode, string>
|
|
26
|
+
}
|
|
27
|
+
script: {
|
|
28
|
+
narrow: Record<ScriptCode, string>
|
|
29
|
+
short: Record<ScriptCode, string>
|
|
30
|
+
long: Record<ScriptCode, string>
|
|
31
|
+
}
|
|
32
|
+
currency: {
|
|
33
|
+
narrow: Record<CurrencyCode, string>
|
|
34
|
+
short: Record<CurrencyCode, string>
|
|
35
|
+
long: Record<CurrencyCode, string>
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Not in spec, but we need this to display both language and region in display name.
|
|
40
|
+
* e.g. zh-Hans-SG + "{0}({1})" -> 简体中文(新加坡)
|
|
41
|
+
* Here {0} is replaced by language display name and {1} is replaced by region display name.
|
|
42
|
+
*/
|
|
43
|
+
patterns: {
|
|
44
|
+
locale: string
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type DisplayNamesLocaleData = LocaleData<DisplayNamesData>
|
package/types/list.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {LocaleData} from './core'
|
|
2
|
+
|
|
3
|
+
export type ListPatternLocaleData = LocaleData<ListPatternFieldsData>
|
|
4
|
+
|
|
5
|
+
export interface ListPatternFieldsData {
|
|
6
|
+
conjunction?: ListPatternData
|
|
7
|
+
disjunction?: ListPatternData
|
|
8
|
+
unit?: ListPatternData
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ListPattern {
|
|
12
|
+
start: string
|
|
13
|
+
middle: string
|
|
14
|
+
end: string
|
|
15
|
+
pair: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ListPatternData {
|
|
19
|
+
long: ListPattern
|
|
20
|
+
short?: ListPattern
|
|
21
|
+
narrow?: ListPattern
|
|
22
|
+
}
|