parsePluralForms
parsePluralForms(
text):PluralForms
Defined in: packages/format-po/src/plural-forms.ts:60
Parses a Plural-Forms header field into a compiled selector.
The value is a C conditional expression over the single variable n, which
is evaluated with integer semantics: / truncates, % is a remainder, and a
comparison yields 0 or 1. It is parsed and compiled to a closure tree
once, never handed to eval or new Function — a translation catalogue is
external input, and every library that has taken that shortcut shipped a code
execution hole with it.
Selecting is then O(1) in the size of the expression’s tree, which is small by construction.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Throws
Section titled “Throws”When the field or the expression does not parse.