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

Function compareCollatorStrings

packages/intl-collator/compare.ts:547–564  ·  view source on GitHub ↗
(
  slots: IntlCollatorInternal,
  x: string,
  y: string
)

Source from the content-addressed store, hash-verified

545}
546
547export function compareCollatorStrings(
548 slots: IntlCollatorInternal,
549 x: string,
550 y: string
551): number {
552 // CompareStrings receives already-ToString-converted values from the
553 // bound compare function and returns a negative/zero/positive Number.
554 // https://tc39.es/ecma402/#sec-comparestrings
555 const left = prepare(x, slots)
556 const right = prepare(y, slots)
557 const result = slots.numeric
558 ? compareNumeric(left, right, slots)
559 : comparePreparedStrings(left, right, slots)
560 if (result) {
561 return result
562 }
563 return compareCaseFirst(x, y, slots.locale, slots.caseFirst)
564}

Callers 1

getFunction · 0.85

Calls 4

prepareFunction · 0.85
compareNumericFunction · 0.85
comparePreparedStringsFunction · 0.85
compareCaseFirstFunction · 0.85

Tested by

no test coverage detected