docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A small utility that converts shorthand descriptors into filter/map callbacks and applies them to collections.
[path, value] descriptor produces a predicate that keeps only items whose nested property strictly equals that value. @testexport type Descriptor =
| string
| [string, any]
| Record<string, any>
| ((value: any) => any);
export type Step =
| { kind: "filter"; descriptor: Descriptor }
| { kind: "map"; descriptor: Descriptor };
export function toCallback(descriptor: Descriptor): (value: any) => any;
/**
* Applies each step to the collection in order. Filter steps keep items for which
* the descriptor-based callback returns truthy. A single map step replaces each item
* with the descriptor-based callback result. The map step must be last and is required.
*/
export function runPipeline(collection: any[], steps: Step[]): any[];Provides callback builders and matchers for property paths and shorthand descriptors.