* Compares two strings that may contain a wildcard character ('*') and returns a value indicating their order. * @param {string} a - The first string to compare. * @param {string} b - The second string to compare. * @returns {number} - A negative number if `a` should come before `b`, a positive n
(a, b)
| 671 | * or 0 if they are equal. |
| 672 | */ |
| 673 | function patternKeyCompare(a, b) { |
| 674 | const aPatternIndex = StringPrototypeIndexOf(a, '*'); |
| 675 | const bPatternIndex = StringPrototypeIndexOf(b, '*'); |
| 676 | const baseLenA = aPatternIndex === -1 ? a.length : aPatternIndex + 1; |
| 677 | const baseLenB = bPatternIndex === -1 ? b.length : bPatternIndex + 1; |
| 678 | if (baseLenA > baseLenB) { return -1; } |
| 679 | if (baseLenB > baseLenA) { return 1; } |
| 680 | if (aPatternIndex === -1) { return 1; } |
| 681 | if (bPatternIndex === -1) { return -1; } |
| 682 | if (a.length > b.length) { return -1; } |
| 683 | if (b.length > a.length) { return 1; } |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | /** |
| 688 | * Resolves the given import name for a package. |
no outgoing calls
no test coverage detected
searching dependent graphs…