Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 32cb503

Browse files
committed
optimized collection method docs
1 parent 64ef306 commit 32cb503

File tree

2 files changed

+251
-74
lines changed

2 files changed

+251
-74
lines changed

docs/Interfaces.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,18 +670,19 @@ Interface of the Object for quick reference, however each property will be expla
670670

671671
```ts
672672
export interface UpdateConfigInterface {
673-
addNewProperties?: boolean;
673+
patch?: boolean | { addNewProperties?: boolean };
674674
background?: boolean;
675675
}
676676
```
677677

678-
#### `addNewProperties`
679-
680-
If new properties that hasn't exist before, get added to the Item Value.
678+
#### `patch`
681679

680+
If the update data object should be merged into the existing data or overwrite it completely.
681+
In case we want to merge the data into the existing data,
682+
we can decide wether new properties are added to the data object or not.
682683
```ts {2}
683684
MY_COLLECTION.collect({id: 1, name: "jeff"});
684-
MY_COLLECTION.update(1, {name: "hans", age: 12}, {addNewProperties: false}); // Item at '1' has value '{name: "hans"}'
685+
MY_COLLECTION.update(1, {name: "hans", age: 12}, {patch: {addNewProperties: false}}); // Item at '1' has value '{name: "hans"}'
685686
MY_COLLECTION.update(1, {name: "frank", age: 10}); // Item at '1' has value '{name: "frank", age: 10}'
686687
```
687688

0 commit comments

Comments
 (0)