Skip to content

Commit

Permalink
feat: remove lodash as a dependency (#2378)
Browse files Browse the repository at this point in the history
This will reduce the bundle size by ~23%(117kb).

Only 4 methods were used `flatten`, `flatMap`, `omitBy`, and `groupBy`.

`omitBy and `groupBy` were recreated while the es2019 implementations of
`flatten` and `flatMap` are used.

`lodash` is still used in the tests which is fine because it makes the
tests cleaner.

Closes #2118
  • Loading branch information
ckniffen committed Feb 1, 2024
1 parent 30bbc3f commit cfb64c3
Show file tree
Hide file tree
Showing 13 changed files with 181 additions and 127 deletions.
179 changes: 90 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"jest": "^29.3.1",
"jest-mock": "^29.3.1",
"lerna": "^4.0.0",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"path-browserify": "1.0.1",
"prettier": "^2.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/xrpl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"bip32": "^2.0.6",
"bip39": "^3.0.4",
"https-proxy-agent": "^5.0.0",
"lodash": "^4.17.4",
"ripple-address-codec": "^4.3.1",
"ripple-binary-codec": "^1.11.0",
"ripple-keypairs": "^1.3.1",
Expand All @@ -45,6 +44,7 @@
"karma-chrome-launcher": "^3.1.1",
"karma-jasmine": "^5.1.0",
"karma-webpack": "^5.0.0",
"lodash": "^4.17.4",
"node-polyfill-webpack-plugin": "^2.0.1",
"react": "^18.2.0",
"typedoc": "0.25.0"
Expand All @@ -58,7 +58,7 @@
"build:lib": "tsc --build tsconfig.build.json",
"build:web": "webpack",
"build:browserTests": "webpack --config ./test/webpack.config.js",
"analyze": "run-s build:web --analyze",
"analyze": "webpack --analyze",
"watch": "run-s build:lib --watch",
"clean": "rm -rf dist build coverage",
"docgen": "tsc --build tsconfig.docs.json && typedoc && echo js.xrpl.org >> ../../docs/CNAME",
Expand Down
2 changes: 1 addition & 1 deletion packages/xrpl/src/Wallet/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import BigNumber from 'bignumber.js'
import { fromSeed } from 'bip32'
import { mnemonicToSeedSync, validateMnemonic } from 'bip39'
import omitBy from 'lodash/omitBy'
import {
classicAddressToXAddress,
isValidXAddress,
Expand All @@ -26,6 +25,7 @@ import ECDSA from '../ECDSA'
import { ValidationError } from '../errors'
import { Transaction, validate } from '../models/transactions'
import { ensureClassicAddress } from '../sugar/utils'
import { omitBy } from '../utils/collections'
import { hashSignedTx } from '../utils/hashes/hashLedger'

import { rfc1751MnemonicToKey } from './rfc1751'
Expand Down
Loading

0 comments on commit cfb64c3

Please sign in to comment.