Commit 416a3f94 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

chore: use native flatMap (#2231)

parent 30cffb74
import { Currency, Token } from '@uniswap/sdk-core' import { Currency, Token } from '@uniswap/sdk-core'
import flatMap from 'lodash.flatmap'
import { useMemo } from 'react' import { useMemo } from 'react'
import { ADDITIONAL_BASES, BASES_TO_CHECK_TRADES_AGAINST, CUSTOM_BASES } from '../constants/routing' import { ADDITIONAL_BASES, BASES_TO_CHECK_TRADES_AGAINST, CUSTOM_BASES } from '../constants/routing'
import { useActiveWeb3React } from './web3' import { useActiveWeb3React } from './web3'
...@@ -20,7 +19,7 @@ export function useAllCurrencyCombinations(currencyA?: Currency, currencyB?: Cur ...@@ -20,7 +19,7 @@ export function useAllCurrencyCombinations(currencyA?: Currency, currencyB?: Cur
}, [chainId, tokenA, tokenB]) }, [chainId, tokenA, tokenB])
const basePairs: [Token, Token][] = useMemo( const basePairs: [Token, Token][] = useMemo(
() => flatMap(bases, (base): [Token, Token][] => bases.map((otherBase) => [base, otherBase])), () => bases.flatMap((base): [Token, Token][] => bases.map((otherBase) => [base, otherBase])),
[bases] [bases]
) )
......
...@@ -4,7 +4,6 @@ import { L2_CHAIN_IDS } from 'constants/chains' ...@@ -4,7 +4,6 @@ import { L2_CHAIN_IDS } from 'constants/chains'
import { SupportedLocale } from 'constants/locales' import { SupportedLocale } from 'constants/locales'
import { L2_DEADLINE_FROM_NOW } from 'constants/misc' import { L2_DEADLINE_FROM_NOW } from 'constants/misc'
import JSBI from 'jsbi' import JSBI from 'jsbi'
import flatMap from 'lodash.flatmap'
import { useCallback, useMemo } from 'react' import { useCallback, useMemo } from 'react'
import { shallowEqual } from 'react-redux' import { shallowEqual } from 'react-redux'
import { useAppDispatch, useAppSelector } from 'state/hooks' import { useAppDispatch, useAppSelector } from 'state/hooks'
...@@ -285,7 +284,7 @@ export function useTrackedTokenPairs(): [Token, Token][] { ...@@ -285,7 +284,7 @@ export function useTrackedTokenPairs(): [Token, Token][] {
const generatedPairs: [Token, Token][] = useMemo( const generatedPairs: [Token, Token][] = useMemo(
() => () =>
chainId chainId
? flatMap(Object.keys(tokens), (tokenAddress) => { ? Object.keys(tokens).flatMap((tokenAddress) => {
const token = tokens[tokenAddress] const token = tokens[tokenAddress]
// for each token on the current chain, // for each token on the current chain,
return ( return (
......
...@@ -13176,11 +13176,6 @@ lodash.debounce@^4.0.8: ...@@ -13176,11 +13176,6 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
lodash.flatmap@^4.5.0:
version "4.5.0"
resolved "https://registry.npmjs.org/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz"
integrity sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=
lodash.get@^4, lodash.get@^4.4.2: lodash.get@^4, lodash.get@^4.4.2:
version "4.4.2" version "4.4.2"
resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz"
......
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