(field)
| 454 | } |
| 455 | |
| 456 | export function stringComparator(field) { |
| 457 | const comparator = function (a, b) { |
| 458 | const objectNullComparison = compareNulls(a, b); |
| 459 | if (!isNull(objectNullComparison)) { |
| 460 | return objectNullComparison; |
| 461 | } |
| 462 | |
| 463 | const value1 = a[field]; |
| 464 | const value2 = b[field]; |
| 465 | |
| 466 | const valueNullComparison = compareNulls(a, b); |
| 467 | if (!isNull(valueNullComparison)) { |
| 468 | return valueNullComparison; |
| 469 | } |
| 470 | |
| 471 | return value1.toLowerCase().localeCompare(value2.toLowerCase()); |
| 472 | }; |
| 473 | |
| 474 | comparator.andThen = function (anotherComparator) { |
| 475 | return function (a, b) { |
| 476 | const result = comparator(a, b); |
| 477 | if (result !== 0) { |
| 478 | return result; |
| 479 | } |
| 480 | |
| 481 | return anotherComparator(a, b); |
| 482 | } |
| 483 | }; |
| 484 | |
| 485 | return comparator |
| 486 | } |
| 487 | |
| 488 | export function scrollToElement(element, onlyWhenOutside = false) { |
| 489 | if (onlyWhenOutside && isVisibleOnScroll(element, false)) { |
nothing calls this directly
no test coverage detected