chore: use native flatMap (#2231)

This commit is contained in:
Zach Pomerantz 2021-09-03 09:29:37 -07:00 committed by GitHub
parent 30cffb7442
commit 416a3f9433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2 additions and 10 deletions

@ -80,7 +80,6 @@
"graphql-request": "^3.4.0",
"inter-ui": "^3.13.1",
"jest-styled-components": "^7.0.5",
"lodash.flatmap": "^4.5.0",
"luxon": "^1.25.0",
"ms.macro": "^2.0.0",
"multicodec": "^3.0.1",

@ -1,5 +1,4 @@
import { Currency, Token } from '@uniswap/sdk-core'
import flatMap from 'lodash.flatmap'
import { useMemo } from 'react'
import { ADDITIONAL_BASES, BASES_TO_CHECK_TRADES_AGAINST, CUSTOM_BASES } from '../constants/routing'
import { useActiveWeb3React } from './web3'
@ -20,7 +19,7 @@ export function useAllCurrencyCombinations(currencyA?: Currency, currencyB?: Cur
}, [chainId, tokenA, tokenB])
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]
)

@ -4,7 +4,6 @@ import { L2_CHAIN_IDS } from 'constants/chains'
import { SupportedLocale } from 'constants/locales'
import { L2_DEADLINE_FROM_NOW } from 'constants/misc'
import JSBI from 'jsbi'
import flatMap from 'lodash.flatmap'
import { useCallback, useMemo } from 'react'
import { shallowEqual } from 'react-redux'
import { useAppDispatch, useAppSelector } from 'state/hooks'
@ -285,7 +284,7 @@ export function useTrackedTokenPairs(): [Token, Token][] {
const generatedPairs: [Token, Token][] = useMemo(
() =>
chainId
? flatMap(Object.keys(tokens), (tokenAddress) => {
? Object.keys(tokens).flatMap((tokenAddress) => {
const token = tokens[tokenAddress]
// for each token on the current chain,
return (

@ -13176,11 +13176,6 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
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:
version "4.4.2"
resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz"