bitcore icon indicating copy to clipboard operation
bitcore copied to clipboard

remove some lodash calls

Open dynst opened this issue 6 months ago • 1 comments

#3949

Excluding isString, isUndefined, isObject, and things like that (which don't have to be removed, if lodash can be replaced with var _ = require('is-what')), there are fewer than 50 lines using lodash in the library code after this PR. (There's much more than that in the tests.)

dynst avatar Jun 30 '25 19:06 dynst

Thanks for the PR @dynst . Before I can merge anything, you'll need to resolve the merge conflict and sign all your commits per the contributing guidelines. Additionally, here are a few notes regarding the work:

  • We'd like to avoid .forEach and instead use for-of loops. .forEach loops are relatively slow and antiquated.
  • lodash typically handles non-iterable values cleanly (e.g. _.includes(null, 'someval') => false, _.each(null, ...) => null) whereas similar declarative calls (e.g. null.includes('someval')) will throw an error. This is worth considering in the codebase when null, undefined, or other non-iterable values may be acceptable.

kajoseph avatar Jul 31 '25 16:07 kajoseph