Reduce dependencies on lodash (#1467)

* assign -> Object.assign

* replace isundefined

* remove forEach

* remove some

* remove reduce

* remove keys

* remove map

* remove includes

* remove filter

* remove last

* remove isstring

* remove every

* remove rearg

* remove indexOf

* remove values

* remove startswith

* remove first and pick

* build smaller lodash

* remove lodash.isequal package

* add lodash-cli dev dependency

* add lodash script

* test fix

* Revert "build smaller lodash" This reverts commit 979446e57f60b29cb5d377b54efe91cfbeae0707.

* upgrade npm

* change ===/!== undefined to ==/!= null
This commit is contained in:
Mayukha Vadari
2021-07-29 20:18:08 -04:00
committed by GitHub
parent 4e49b6a99c
commit 6e0fff2ad6
52 changed files with 3348 additions and 3271 deletions

View File

@@ -29,7 +29,7 @@ function verifyTransaction(testcase, hash, type, options, txData, address) {
assert.strictEqual(data.type, type)
assert.strictEqual(data.address, address)
assert.strictEqual(data.outcome.result, 'tesSUCCESS')
if (testcase.transactions !== undefined) {
if (testcase.transactions != null) {
testcase.transactions.push(hash)
}
return {txJSON: JSON.stringify(txData), id: hash, tx: data}
@@ -320,11 +320,11 @@ describe('integration tests', function () {
const txData = JSON.parse(result.txJSON)
return this.api.getOrders(address).then((orders) => {
assert(orders && orders.length > 0)
const createdOrder = _.first(
_.filter(orders, (order) => {
const createdOrder = (
orders.filter((order) => {
return order.properties.sequence === txData.Sequence
})
)
)[0]
assert(createdOrder)
assert.strictEqual(createdOrder.properties.maker, address)
assert.deepEqual(createdOrder.specification, orderSpecification)
@@ -390,7 +390,8 @@ describe('integration tests', function () {
it('getTrustlines', function () {
const fixture = requests.prepareTrustline.simple
const options = _.pick(fixture, ['currency', 'counterparty'])
const { currency, counterparty } = fixture
const options = { currency, counterparty }
return this.api.getTrustlines(address, options).then((data) => {
assert(data && data.length > 0 && data[0] && data[0].specification)
const specification = data[0].specification
@@ -402,7 +403,8 @@ describe('integration tests', function () {
it('getBalances', function () {
const fixture = requests.prepareTrustline.simple
const options = _.pick(fixture, ['currency', 'counterparty'])
const { currency, counterparty } = fixture
const options = { currency, counterparty }
return this.api.getBalances(address, options).then((data) => {
assert(data && data.length > 0 && data[0])
assert.strictEqual(data[0].currency, fixture.currency)
@@ -488,7 +490,7 @@ describe('integration tests', function () {
return this.api.getPaths(pathfind).then((data) => {
assert(data && data.length > 0)
assert(
_.every(data, (path) => {
data.every((path) => {
return (
parseFloat(path.source.amount.value) <=
parseFloat(pathfind.source.amount.value)
@@ -551,7 +553,7 @@ describe('integration tests - standalone rippled', function () {
})
})
.then(() => {
const multisignInstructions = _.assign({}, instructions, {
const multisignInstructions = Object.assign({}, instructions, {
signersCount: 2
})
return this.api

View File

@@ -26,7 +26,7 @@ function pay(api, from, to, amount, secret, currency = 'XRP', counterparty) {
}
};
if (counterparty !== undefined) {
if (counterparty != null) {
paymentSpecification.source.maxAmount.counterparty = counterparty;
paymentSpecification.destination.amount.counterparty = counterparty;
}