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

Function collationElements

packages/intl-collator/compare.ts:385–399  ·  view source on GitHub ↗
(
  input: string,
  tailoring: readonly TailoringEntry[]
)

Source from the content-addressed store, hash-verified

383}
384
385function collationElements(
386 input: string,
387 tailoring: readonly TailoringEntry[]
388): PackedCollationElement[] {
389 const codePoints = stringToCodePoints(input)
390 const elements: PackedCollationElement[] = []
391 for (let i = 0; i < codePoints.length; ) {
392 const match =
393 lookupTailoredElements(tailoring, codePoints, i) ||
394 lookupRootElements(codePoints, i)
395 elements.push(...match.elements)
396 i += match.length
397 }
398 return elements
399}
400
401function levelCount(slots: IntlCollatorInternal): number {
402 // ECMA-402 sensitivity selects how many UCA levels participate in

Callers 1

comparePreparedStringsFunction · 0.85

Calls 3

stringToCodePointsFunction · 0.85
lookupTailoredElementsFunction · 0.85
lookupRootElementsFunction · 0.85

Tested by

no test coverage detected