import from lodash/

This commit is contained in:
Mayukha Vadari
2021-10-18 16:17:17 -04:00
parent 9bf7df868e
commit 9fa3f73d5a
5 changed files with 4 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable complexity -- verifies 19 tx types hence a lot of checks needed */ /* eslint-disable complexity -- verifies 19 tx types hence a lot of checks needed */
/* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */ /* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */
import _ from 'lodash' import isEqual from 'lodash/isEqual'
import { encode, decode } from 'ripple-binary-codec' import { encode, decode } from 'ripple-binary-codec'
import { ValidationError } from '../../errors' import { ValidationError } from '../../errors'
@@ -164,7 +164,7 @@ export function validate(transaction: Record<string, unknown>): void {
} }
if ( if (
!_.isEqual( !isEqual(
decode(encode(tx)), decode(encode(tx)),
omitBy(tx, (value) => value == null), omitBy(tx, (value) => value == null),
) )

View File

@@ -1,5 +1,5 @@
import BigNumber from 'bignumber.js' import BigNumber from 'bignumber.js'
import _ from 'lodash' import groupBy from 'lodash/groupBy'
import { Amount, IssuedCurrencyAmount } from '../models/common' import { Amount, IssuedCurrencyAmount } from '../models/common'
import TransactionMetadata, { Node } from '../models/transactions/metadata' import TransactionMetadata, { Node } from '../models/transactions/metadata'
@@ -66,7 +66,7 @@ function normalizeNodes(metadata: TransactionMetadata): NormalizedNode[] {
} }
function groupByAccount(balanceChanges: BalanceChange[]): BalanceChanges[] { function groupByAccount(balanceChanges: BalanceChange[]): BalanceChanges[] {
const grouped = _.groupBy(balanceChanges, (node) => node.account) const grouped = groupBy(balanceChanges, (node) => node.account)
return Object.entries(grouped).map(([account, items]) => { return Object.entries(grouped).map(([account, items]) => {
return { account, balances: items.map((item) => item.balance) } return { account, balances: items.map((item) => item.balance) }
}) })

View File

@@ -1,5 +1,4 @@
import { assert } from 'chai' import { assert } from 'chai'
import _ from 'lodash'
import { ServerInfoResponse } from '../src' import { ServerInfoResponse } from '../src'

View File

@@ -1,5 +1,4 @@
import { assert } from 'chai' import { assert } from 'chai'
import _ from 'lodash'
import { Client } from 'xrpl-local' import { Client } from 'xrpl-local'

View File

@@ -2,7 +2,6 @@
import net from 'net' import net from 'net'
import { assert } from 'chai' import { assert } from 'chai'
import _ from 'lodash'
import { import {
Client, Client,