( slots: IntlCollatorInternal, x: string, y: string )
| 545 | } |
| 546 | |
| 547 | export 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 | } |
no test coverage detected