YuriGor / deepdash

eachDeep, filterDeep, findDeep, someDeep, omitDeep, pickDeep, keysDeep etc.. Tree traversal library written in Underscore/Lodash fashion
https://deepdash.io/
MIT License
275 stars 12 forks source link

Iteratee should have less arguments #7

Closed YuriGor closed 5 years ago

YuriGor commented 5 years ago

I received good feedback, I agree with. Iteratee should have less arguments, now it's hard to remember right order, also code looks unreadable when last argument needed. value, key, may be source collection will be enough, same as in Lodash. Rest of arguments such as path, depth, parent* should be passed as fields of single object context or properties. It will be breaking change, so I need to think twice.

YuriGor commented 5 years ago

Due to lack of feedback I started discussion in this Lodash issue Welcome anybody, who have anything to say.

YuriGor commented 5 years ago

To mimic native js array methods predicates but still have it usable I decided to have this predicate signature:

(value, key|index, parentValue, context)

where context is an object with fields:

next three fields are available if options.checkCircular was true, otherwise they will be undefined

YuriGor commented 5 years ago

done in v2.0.0