infrastructure-upgrade/lib/v3-periphery/test/shared/tokenSort.ts
T-Hax 735546619e
init
Signed-off-by: T-Hax <>
2023-04-08 18:46:18 +00:00

11 lines
340 B
TypeScript

export function compareToken(a: { address: string }, b: { address: string }): -1 | 1 {
return a.address.toLowerCase() < b.address.toLowerCase() ? -1 : 1
}
export function sortedTokens(
a: { address: string },
b: { address: string }
): [typeof a, typeof b] | [typeof b, typeof a] {
return compareToken(a, b) < 0 ? [a, b] : [b, a]
}