The .update() can be used to perform updates on collections. See .at() for more details on its usage. For .update() examples see the examples section for .at() below.

🚧

Collections passed in the .from() will get in-place updated (passed by reference). Collections added via .union() or .join() functions will not get in-place updates. The .update() must also be followed by an .at() to define what records to update.

The predicate() function will receive two arguments that is the collection currently being iterated over and the current index number. The predicate will be executed by the .at() if the row is truthy. The predicate function is where you would perform any of your row update logic.

update( Function( array, index) )
interface IAt {
  at(): jinqJs;
  at(...fields: string[]): jinqJs;
  at<T>(predicate: PredicateCollection<T>): jinqJs;
}

type Collection<T> = T[];
type PredicateCollection<T> = (collection: Collection<T>, index: number) => boolean;

update<T>(predicate: PredicateCollection<T>): IAt;