Releases: AndrewRedican/mitsuketa
deepRemove_Key, deepRemoveAll_Key
Delete properties from plain or deeply nested or complex objects.
deepClone & Key Renaming
This release features:
- Clone for exact non-reference copies, shallow clones, and branch clones
- Rename one or all keys of identity on the fly
Deep Search by Key
- locate(), deepGet(), locateAll(), deepFilter() functions now have a counterpart each that supports deep search by key or property name. Check them out! locate_Key, deepGet_Key, locateAll_Key, deepFilter_Key.
maxDepth() & matchDepth()
- New functions maxDepth() & matchDepth.
- Full maxDepth Support and Test Coverage.
maxDepth parameter is now supported for v1.1.x Features.
- Feature v1.1 functions: locate, deepGet, locateAll, and deepFilter now support a maxDepth parameter to limit the deep search to a certain number of depths inside a collection. Choosing to omit this param, will asign it to the default behavoir of evaluating all object depths.
This is especially useful in scenarios where you'd like to locate or get data off of a complex collection that is buried several layers or levels deep, and just so happens there are subcollections within the object tree that have the same property and value that you are not looking for.
For example, your collection might be an array of car objects, and, taking it no-sql approach of storing data to the extreme, it nests information about each component in it, and the components of the main components are also embeded.
Making a case:
You want to get the information about 'Pistion pin boss reinforcement' which is nested along with the other components of a 'piston' object, which in turn is embeded in a 'engine' of 'reciprocating' type. If by any chance you'd place the same property, such as a key id of sorts, and you've used only natural numbers, begining with 1,2,3.. and so on, and it is common for you to use this particular style throughout other components within the same object tree, locate, and deepGet would get you all the matches, even the unnecessary ones.
Now, you can be specific, if you want, about how deep you want to go to extract data from a complex and large object tree.
List filtering based on deepsearch criteria
This release includes the following new features:
exists
onlyExisting
onlyMissing
length
isFalsy
isTruthy
foundTruthy
onlyTruthy
foundFalsy
onlyFalsy
deepFilter() and locateAll()
This release contains all the functionality it was originally intended to have.
deepFilter() provides a way all deeply nested identities that match a certain criteria. No more iterating over layers and properties! Get the data on the fly.
locateAll() provides the paths to all deeply nested identities that match a certain criteria. deepFilter() makes use of this function. By itself, its stands as good way to log and review what the identities are matching.