@caja/query
v0.1.3
Published
Caja query lib made to provide helpfull functions to query data
Readme
@caja/query
This repository contains the query library for the Caja language. It provides a set of functional utilities to manipulate and query arrays.
Functions
map<T, K>(arr: [T], transform: fn(T) -> K) -> [K]
Transforms an array by applying a given transform function to each element. Returns a new array containing the transformed elements.
filter<T>(arr: [T], predicate: fn(T) -> Boolean) -> [T]
Filters an array by keeping only the elements that satisfy the given predicate function. Returns a new array with the matching elements.
reduce<T, K>(arr: [T], reducer: fn(T, K) -> K, seed: K) -> K
Reduces an array to a single value. It iterates through the array and applies the reducer function to each element and the accumulated value, starting with the initial seed. Returns the final accumulated value.
