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

Function extractUnitPattern

packages/intl-numberformat/scripts/extract-units.ts:21–30  ·  view source on GitHub ↗
(d: Units['long']['volume-gallon'])

Source from the content-addressed store, hash-verified

19export type Units = (typeof UnitsData)['main']['en']['units']
20
21function extractUnitPattern(d: Units['long']['volume-gallon']) {
22 return collapseSingleValuePluralRule(
23 PLURAL_RULES.reduce((all: LDMLPluralRuleMap<string>, ldml) => {
24 if (d[`unitPattern-count-${ldml}` as 'unitPattern-count-one']) {
25 all[ldml] = d[`unitPattern-count-${ldml}` as 'unitPattern-count-one']
26 }
27 return all
28 }, {} as any)
29 )
30}
31
32async function loadUnits(locale: string): Promise<UnitDataTable> {
33 const units = (

Callers 1

loadUnitsFunction · 0.85

Calls 1

Tested by

no test coverage detected