MCPcopy
hub / github.com/formatjs/formatjs / getPluralRuleSortOrder

Function getPluralRuleSortOrder

packages/icu-messageformat-parser/printer.ts:222–231  ·  view source on GitHub ↗
(rule: string)

Source from the content-addressed store, hash-verified

220}
221
222function getPluralRuleSortOrder(rule: string): [number, number] {
223 const categoryOrder = PLURAL_RULE_ORDER[rule]
224 if (categoryOrder !== undefined) {
225 return [categoryOrder, 0]
226 }
227
228 const exactRule = rule.replace(/^=+/, '')
229 const exactValue = /^[+-]?\d+$/.test(exactRule) ? Number(exactRule) : 0
230 return [6, exactValue]
231}
232
233function printPluralElement(el: PluralElement) {
234 const type = el.pluralType === 'cardinal' ? 'plural' : 'selectordinal'

Callers 1

printPluralElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected