{"_id":"566a1c83e233063900c10f80","githubsync":"","version":{"_id":"5667237fee53940d00516247","__v":4,"project":"5667237eee53940d00516244","createdAt":"2015-12-08T18:37:51.439Z","releaseDate":"2015-12-08T18:37:51.439Z","categories":["56672380ee53940d00516248","5667789f575ec10d00640b80","566779078c573e0d00023d96","56677e2bbe6e390d004eb463"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"project":"5667237eee53940d00516244","__v":4,"category":{"_id":"5667789f575ec10d00640b80","pages":["56677ec5be6e390d004eb465","566780b78f1eec0d00d9e391","566791b8ee1dbf0d008f611b","566794b305cae40d00bea738","5667957306039e0d00c4eba7","5668d4e1f921480d00a34555","5668d76dc3de130d004416ba","5668d8b7d000ff1700ca477a","5668d97b07625117002c2727","5668dcf02961f917006ada2c","566a1c83e233063900c10f80","566a1eaed000ff1700ca4941","566a1ec007625117002c29e9","566a2391434e53390069d8e3","566a26b455e4b32100935f47","566a2716f625510d000e55e6","566a29cbf625510d000e55e9","566a2fdf0405980d001f40af","566a30451766bf0d00e737bd","566a328bf625510d000e55f1","566a34561e08750d00a0c497","566a348d1766bf0d00e737c4","566b92b471dc6a0d00b2493c"],"version":"5667237fee53940d00516247","__v":23,"project":"5667237eee53940d00516244","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-09T00:41:03.215Z","from_sync":false,"order":1,"slug":"api-reference","title":"API Reference"},"user":"56672364f672550d00085227","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-11T00:44:51.318Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":20,"body":"The .update() can be used to perform updates on collections. See [.at()](https://jinqjs.readme.io/docs/at) for more details on its usage.** For .update() examples see the examples section for [.at()](https://jinqjs.readme.io/docs/at) below.** \n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Collections passed in the [.from() ](https://jinqjs.readme.io/docs/from)will get in-place updated (passed by reference).  Collections added via [.union()](https://jinqjs.readme.io/docs/union) or [.join()](https://jinqjs.readme.io/docs/join) functions will not get in-place updates.  The .update() must also be followed by an [.at()](https://jinqjs.readme.io/docs/at) to define what records to update.\"\n}\n[/block]\nThe 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()](https://jinqjs.readme.io/docs/at) if the row is truthy.  The predicate function is where you would perform any of your row update logic.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"update( Function( array, index) )\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"interface IAt {\\n  at(): jinqJs;\\n  at(...fields: string[]): jinqJs;\\n  at<T>(predicate: PredicateCollection<T>): jinqJs;\\n}\\n\\ntype Collection<T> = T[];\\ntype PredicateCollection<T> = (collection: Collection<T>, index: number) => boolean;\\n\\nupdate<T>(predicate: PredicateCollection<T>): IAt;\",\n      \"language\": \"javascript\",\n      \"name\": \"TypeScript\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"update","type":"fn","title":"update"}
The .update() can be used to perform updates on collections. See [.at()](https://jinqjs.readme.io/docs/at) for more details on its usage.** For .update() examples see the examples section for [.at()](https://jinqjs.readme.io/docs/at) below.** [block:callout] { "type": "warning", "body": "Collections passed in the [.from() ](https://jinqjs.readme.io/docs/from)will get in-place updated (passed by reference). Collections added via [.union()](https://jinqjs.readme.io/docs/union) or [.join()](https://jinqjs.readme.io/docs/join) functions will not get in-place updates. The .update() must also be followed by an [.at()](https://jinqjs.readme.io/docs/at) to define what records to update." } [/block] 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()](https://jinqjs.readme.io/docs/at) if the row is truthy. The predicate function is where you would perform any of your row update logic. [block:code] { "codes": [ { "code": "update( Function( array, index) )", "language": "javascript" } ] } [/block] [block:code] { "codes": [ { "code": "interface IAt {\n at(): jinqJs;\n at(...fields: string[]): jinqJs;\n at<T>(predicate: PredicateCollection<T>): jinqJs;\n}\n\ntype Collection<T> = T[];\ntype PredicateCollection<T> = (collection: Collection<T>, index: number) => boolean;\n\nupdate<T>(predicate: PredicateCollection<T>): IAt;", "language": "javascript", "name": "TypeScript" } ] } [/block]