MCPcopy Index your code
hub / github.com/formatjs/formatjs / reduceNumCount

Function reduceNumCount

packages/intl-numberformat/scripts/extract-numbers.ts:36–55  ·  view source on GitHub ↗
(d: T)

Source from the content-addressed store, hash-verified

34] as Array<DecimalFormatNum>
35
36function reduceNumCount<
37 T extends
38 Numbers['decimalFormats-numberSystem-latn']['long']['decimalFormat'],
39>(d: T): Record<DecimalFormatNum, LDMLPluralRuleMap<string>> {
40 return COUNTS.reduce(
41 (all: Record<DecimalFormatNum, LDMLPluralRuleMap<string>>, num) => {
42 all[num] = collapseSingleValuePluralRule(
43 PLURAL_RULES.reduce(
44 (all: LDMLPluralRuleMap<string>, pl) => {
45 all[pl] = d[`${num}-count-${pl}` as '1000-count-one']
46 return all
47 },
48 {other: d[`${num}-count-other` as '1000-count-other']}
49 )
50 )
51 return all
52 },
53 {} as Record<DecimalFormatNum, LDMLPluralRuleMap<string>>
54 )
55}
56
57function extractNumbers(d: Numbers): RawNumberData {
58 const nu =

Callers 1

extractNumbersFunction · 0.85

Calls 1

Tested by

no test coverage detected