Commit dd94c2c4 authored by Noah Zinsmeister's avatar Noah Zinsmeister

remove flatmap sugar in favor of map + flat

parent 563f413c
...@@ -14,7 +14,7 @@ export class Route { ...@@ -14,7 +14,7 @@ export class Route {
invariant(exchanges.length > 0, `${exchanges} does not consist of at least 1 exchange.`) invariant(exchanges.length > 0, `${exchanges} does not consist of at least 1 exchange.`)
// validate conditions that must be true of a Route // validate conditions that must be true of a Route
const chainIds = exchanges.flatMap(exchange => exchange.pair.map(token => token.chainId)) const chainIds = exchanges.map(exchange => exchange.pair.map(token => token.chainId)).flat()
chainIds.forEach((chainId, _, array) => invariant(chainId === array[0], `${chainIds} are not all equal.`)) chainIds.forEach((chainId, _, array) => invariant(chainId === array[0], `${chainIds} are not all equal.`))
const path = [input] const path = [input]
exchanges.forEach((exchange, i) => { exchanges.forEach((exchange, i) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment