The type of the object to be processed. Must be an object type.
The Zod type representing the pattern for matching sub-objects within the object. Must be a Zod type that infers to a record (object) structure.
The type of the object returned by the callback function. This type's properties are merged into the matching sub-objects.
The parameters for the function.
A callback function that is invoked for each sub-object matching the pattern. The function should return an object whose properties will be merged into the matching sub-object.
The Zod pattern used to match sub-objects within
value
. Sub-objects that match this pattern are transformed by the callback function.
Optional
shouldThe object to be processed. This object is traversed to find sub-objects that match the given pattern.
value
.See demo fixture in tests/patternMatch.test.ts for example use.
Generated using TypeDoc
Modifies an object by merging additional properties returned by a callback function onto each nested object that matches a specified Zod pattern. This function performs a post-order depth-first search (DFS) traversal of the object, applying the transformation wherever the pattern matches.
*** Ignores any processing done by zod such as stripping away extra properties. ***