mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Use Boolean for filters (#10066)
This commit is contained in:
parent
8f40d03299
commit
9a1548368f
@ -249,9 +249,7 @@ export default class IncomingTransactionsController {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const incomingTxs = remoteTxs.filter(
|
const incomingTxs = remoteTxs.filter(
|
||||||
(tx) =>
|
(tx) => tx.txParams?.to?.toLowerCase() === address.toLowerCase(),
|
||||||
tx.txParams.to &&
|
|
||||||
tx.txParams.to.toLowerCase() === address.toLowerCase(),
|
|
||||||
)
|
)
|
||||||
incomingTxs.sort((a, b) => (a.time < b.time ? -1 : 1))
|
incomingTxs.sort((a, b) => (a.time < b.time ? -1 : 1))
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ function calcCustomGasLimit(customGasLimitInHex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sumHexWEIsToRenderableEth(hexWEIs) {
|
function sumHexWEIsToRenderableEth(hexWEIs) {
|
||||||
const hexWEIsSum = hexWEIs.filter((n) => n).reduce(addHexes)
|
const hexWEIsSum = hexWEIs.filter(Boolean).reduce(addHexes)
|
||||||
return formatETHFee(
|
return formatETHFee(
|
||||||
getValueFromWeiHex({
|
getValueFromWeiHex({
|
||||||
value: hexWEIsSum,
|
value: hexWEIsSum,
|
||||||
|
@ -21,7 +21,7 @@ export default class MultipleNotifications extends PureComponent {
|
|||||||
const { showAll } = this.state
|
const { showAll } = this.state
|
||||||
const { children, classNames } = this.props
|
const { children, classNames } = this.props
|
||||||
|
|
||||||
const childrenToRender = children.filter((child) => child)
|
const childrenToRender = children.filter(Boolean)
|
||||||
if (childrenToRender.length === 0) {
|
if (childrenToRender.length === 0) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ export default class PageContainer extends PureComponent {
|
|||||||
renderActiveTabContent() {
|
renderActiveTabContent() {
|
||||||
const { tabsComponent } = this.props
|
const { tabsComponent } = this.props
|
||||||
let { children } = tabsComponent.props
|
let { children } = tabsComponent.props
|
||||||
children = children.filter((child) => child)
|
children = children.filter(Boolean)
|
||||||
const { activeTabIndex } = this.state
|
const { activeTabIndex } = this.state
|
||||||
|
|
||||||
return children[activeTabIndex]
|
return children[activeTabIndex]
|
||||||
|
@ -183,7 +183,7 @@ export function addHexes(aHexWEI, bHexWEI) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function sumHexWEIs(hexWEIs) {
|
export function sumHexWEIs(hexWEIs) {
|
||||||
return hexWEIs.filter((n) => n).reduce(addHexes)
|
return hexWEIs.filter(Boolean).reduce(addHexes)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sumHexWEIsToUnformattedFiat(
|
export function sumHexWEIsToUnformattedFiat(
|
||||||
|
@ -145,9 +145,7 @@ export function useTokensToSearch({
|
|||||||
return new BigNumber(rawFiat || 0).gt(secondRawFiat || 0) ? -1 : 1
|
return new BigNumber(rawFiat || 0).gt(secondRawFiat || 0) ? -1 : 1
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
tokensToSearchBuckets.top = tokensToSearchBuckets.top.filter(
|
tokensToSearchBuckets.top = tokensToSearchBuckets.top.filter(Boolean)
|
||||||
(token) => token,
|
|
||||||
)
|
|
||||||
return [
|
return [
|
||||||
...tokensToSearchBuckets.owned,
|
...tokensToSearchBuckets.owned,
|
||||||
...tokensToSearchBuckets.top,
|
...tokensToSearchBuckets.top,
|
||||||
|
@ -159,7 +159,7 @@ export default connect(
|
|||||||
)(SwapsGasCustomizationModalComponent)
|
)(SwapsGasCustomizationModalComponent)
|
||||||
|
|
||||||
function sumHexWEIsToRenderableEth(hexWEIs) {
|
function sumHexWEIsToRenderableEth(hexWEIs) {
|
||||||
const hexWEIsSum = hexWEIs.filter((n) => n).reduce(addHexes)
|
const hexWEIsSum = hexWEIs.filter(Boolean).reduce(addHexes)
|
||||||
return formatETHFee(
|
return formatETHFee(
|
||||||
getValueFromWeiHex({
|
getValueFromWeiHex({
|
||||||
value: hexWEIsSum,
|
value: hexWEIsSum,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user