-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Open-source Haste conflict computation, remove leaky getRawHasteMap
Differential Revision: D66927755
- Loading branch information
1 parent
e15bfd5
commit 9512ae0
Showing
4 changed files
with
125 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict | ||
* @format | ||
*/ | ||
|
||
// Utilities for working with Array.prototype.sort | ||
|
||
export function compareStrings(a: null | string, b: null | string): number { | ||
if (a == null) { | ||
return b == null ? 0 : -1; | ||
} | ||
if (b == null) { | ||
return 1; | ||
} | ||
return a.localeCompare(b); | ||
} | ||
|
||
export function chainComparators<T>( | ||
...comparators: Array<(a: T, b: T) => number> | ||
): (a: T, b: T) => number { | ||
return (a, b) => { | ||
for (const comparator of comparators) { | ||
const result = comparator(a, b); | ||
if (result !== 0) { | ||
return result; | ||
} | ||
} | ||
return 0; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters