bitcore
bitcore copied to clipboard
remove some lodash calls
#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.)
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
.forEachand instead use for-of loops..forEachloops 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.