| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This pull request removes the lodash runtime dependency from packages/bitcore-lib by replacing lodash helpers with equivalent native JavaScript implementations across the library and its test suite.
Changes:
Copilot reviewed 45 out of 46 changed files in this pull request and generated 1 comment.
Show a summary per file| File | Description |
|---|---|
| packages/bitcore-lib/test/transaction/unspentoutput.js | Drops lodash usage in tests; uses structuredClone for deep copy. |
| packages/bitcore-lib/test/transaction/transaction.js | Replaces lodash shuffle stubbing with Math.random stubbing; minor test cleanups. |
| packages/bitcore-lib/test/transaction/signature.js | Removes unused lodash/chai should imports from test file. |
| packages/bitcore-lib/test/transaction/output.js | Removes unused imports (expect/lodash/errors) after cleanup. |
| packages/bitcore-lib/test/transaction/input/publickeyhash.js | Removes lodash/chai imports (relies on existing test environment setup). |
| packages/bitcore-lib/test/transaction/input/multisigscripthash.js | Replaces lodash-based assertions with native array mapping + chai members checks. |
| packages/bitcore-lib/test/transaction/input/multisig.js | Replaces lodash checks with native array mapping + chai members checks. |
| packages/bitcore-lib/test/transaction/input/input.js | Replaces lodash iteration with for...of; adds lint suppressions for bitwise ops. |
| packages/bitcore-lib/test/script/interpreter.js | Removes lodash and replaces array checks/iteration with native constructs. |
| packages/bitcore-lib/test/opcode.js | Replaces _.size with Object.keys(...).length. |
| packages/bitcore-lib/test/hdpublickey.js | Removes lodash/assert usage; modernizes to const + chai deep equality. |
| packages/bitcore-lib/test/hdprivatekey.js | Removes lodash/assert usage; replaces lodash iteration with for...of. |
| packages/bitcore-lib/test/hdkeys.js | Replaces _.each with for...of; removes unused imports. |
| packages/bitcore-lib/test/crypto/signature.js | Replaces lodash iteration with loops; updates fixture runner implementation. |
| packages/bitcore-lib/package.json | Removes lodash dependency; pins elliptic to an exact version. |
| packages/bitcore-lib/package-lock.json | Updates lockfile to reflect dependency removal and related resolution changes. |
| packages/bitcore-lib/lib/util/preconditions.js | Replaces lodash string checks with typeof. |
| packages/bitcore-lib/lib/util/js.js | Replaces lodash checks and forEach with native checks/loops; simplifies try/catch. |
| packages/bitcore-lib/lib/uri.js | Removes lodash; switches to Object.assign and native loops; replaces URL variable usage. |
| packages/bitcore-lib/lib/unit.js | Removes lodash; replaces object checks and iteration with native constructs. |
| packages/bitcore-lib/lib/transaction/unspentoutput.js | Removes lodash; replaces undefined/number/object checks with native equivalents. |
| packages/bitcore-lib/lib/transaction/transaction.js | Removes lodash; replaces sum/difference/without/shuffle with native implementations. |
| packages/bitcore-lib/lib/transaction/output.js | Removes lodash type checks; adds bitwise lint suppression and minor cleanup. |
| packages/bitcore-lib/lib/transaction/input/multisigscripthash.js | Replaces _.sortBy with explicit array copy + comparator sort. |
| packages/bitcore-lib/lib/transaction/input/multisig.js | Replaces lodash collection helpers with native map/filter/reduce/sort and loops. |
| packages/bitcore-lib/lib/transaction/input/input.js | Removes lodash; replaces type checks; adds bitwise lint suppressions. |
| packages/bitcore-lib/lib/script/script.js | Removes lodash; replaces object checks and sorting with native equivalents. |
| packages/bitcore-lib/lib/script/interpreter.js | Removes lodash; replaces undefined checks with nullish checks; adds JSUtil usage. |
| packages/bitcore-lib/lib/publickey.js | Removes lodash; replaces isUndefined patterns with explicit === undefined checks. |
| packages/bitcore-lib/lib/privatekey.js | Removes lodash; replaces null/undefined and string/object checks with native checks. |
| packages/bitcore-lib/lib/opcode.js | Removes lodash; replaces type checks and _.extend with Object.assign. |
| packages/bitcore-lib/lib/message.js | Removes lodash; replaces string checks with typeof. |
| packages/bitcore-lib/lib/hdpublickey.js | Removes lodash; replaces collection/type helpers with native equivalents. |
| packages/bitcore-lib/lib/hdprivatekey.js | Removes lodash; replaces includes/some/every/type checks with native equivalents. |
| packages/bitcore-lib/lib/errors/index.js | Removes lodash; replaces _.each and type checks with native equivalents. |
| packages/bitcore-lib/lib/encoding/bufferreader.js | Removes lodash; replaces undefined/string/object checks with native equivalents. |
| packages/bitcore-lib/lib/encoding/base58check.js | Removes lodash; replaces string checks with typeof. |
| packages/bitcore-lib/lib/encoding/base58.js | Removes lodash; rewrites validCharacters with native checks/iteration. |
| packages/bitcore-lib/lib/crypto/signature.js | Removes lodash; introduces helper for DER sign-bit checks; adjusts strict defaulting. |
| packages/bitcore-lib/lib/crypto/point.js | Removes unused catch variable; minor import order tweak. |
| packages/bitcore-lib/lib/crypto/bn.js | Removes lodash; replaces type checks; adds bitwise lint suppressions. |
| packages/bitcore-lib/lib/block/merkleblock.js | Removes lodash; replaces extend/array checks/undefined checks with native equivalents. |
| packages/bitcore-lib/lib/block/blockheader.js | Removes lodash; replaces type checks; replaces noop setter. |
| packages/bitcore-lib/lib/block/block.js | Removes lodash; replaces extend and array building with native equivalents. |
| packages/bitcore-lib/lib/address.js | Removes lodash; replaces array/object/number checks and mapping with native equivalents. |
| packages/bitcore-lib/index.js | Stops exporting lodash via bitcore.deps._. |
packages/bitcore-lib/test/crypto/signature.js:262
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
|
@MichaelAJay Man, I forgot about this PR. Could you dust this off by resolving the conflicts, please? |
Sorry, something went wrong.
There was a problem hiding this comment.
The vulnerable elliptic pin and several functional and test regressions must be corrected.
Review effort: Balanced
Findings: 2 · 6
· 1
Sorry, something went wrong.
| this._inputAmount = 0; | ||
| for (const input of this.inputs || []) { | ||
| if (input.output == null) { | ||
| throw new errors.Transaction.Input.MissingPreviousOutput(); | ||
| } |
| "elliptic": "^6.5.3", | ||
| "inherits": "=2.0.1", | ||
| "lodash": "^4.17.20" | ||
| "elliptic": "=6.5.3", |
| // Backwards compat: lodash _.map(null/undefined) yields [], _.every([]) is true. | ||
| if (chars == null) { | ||
| return true; | ||
| } | ||
| if (typeof chars !== 'string') { | ||
| // Backwards compat: lodash _.map on non-string primitives (number, boolean, etc.) yields []. | ||
| // Boxed strings must be unwrapped: lodash maps each character of String objects. | ||
| if (chars instanceof String) { | ||
| chars = chars.valueOf(); | ||
| } else { | ||
| return true; | ||
| } | ||
| } | ||
| return Array.prototype.every.call(chars, char => ALPHABET.includes(char)); |
| for (let i = 0; i < set.length; i++) { | ||
| const vector = set[i]; |
|
|
||
| const _ = require('lodash'); | ||
| const should = require('chai').should(); | ||
| const expect = require('chai').expect; |
| var xpubkeyTestnet = 'tpubD6NzVbkrYhZ4WZaiWHz59q5EQ61bd6dUYfU4ggRWAtNAyyYRNWT6ktJ7UHJEXURvTfTfskFQmK7Ff4FRkiRN5wQH8nkGAb6aKB4Yyeqsw5m'; | ||
| var json = '{"network":"livenet","depth":0,"fingerPrint":876747070,"parentFingerPrint":0,"childIndex":0,"chainCode":"873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d508","publicKey":"0339a36013301597daef41fbe593a02cc513d0b55527ec2df1050e2e8ff49c85c2","checksum":-1421395167,"xpubkey":"xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8"}'; | ||
| var derived_0_1_200000 = 'xpub6BqyndF6rkBNTV6LXwiY8Pco8aqctqq7tGEUdA8fmGDTnDJphn2fmxr3eM8Lm3m8TrNUsLbEjHvpa3adBU18YpEx4tp2Zp6nqax3mQkudhX'; | ||
| const expect = require('chai').expect; |
|
|
||
| const bitcore = require('../../..'); | ||
|
|
||
| const expect = require('chai').expect; | ||
| const _ = require('lodash'); | ||
|
|
||
| const bitcore = require('../../..'); |
| * @param {number} threshold amount of required signatures to spend the output | ||
| * @param {Array} signatures and array of signature buffers to append to the script | ||
| * @param {Object=} opts | ||
| * @param {Object=} _opts |
| Back | FazBrowse Home | New Git URL |
Description
Remove lodash from bitcore-lib. Also some general cleanup, and especially 'forEach' fixing.
Changelog
Testing Notes
Checklist