@@ -653,31 +653,36 @@ MY_COLLECTION.getSelector(1); // Returns Selector that got just created
653
653
| --------------------------| -----------| ----------|
654
654
| ` boolean ` | false | No |
655
655
656
+
657
+
656
658
<br />
657
659
658
660
---
659
661
660
662
<br />
661
663
664
+
665
+
662
666
## ` UpdateConfig `
663
667
664
668
This is the ` UpdateConfig ` Interface, and it is used as config object in the ` update ` method. Here is a Typescript
665
669
Interface of the Object for quick reference, however each property will be explained in more detail below.
666
670
667
671
``` ts
668
672
export interface UpdateConfigInterface {
669
- addNewProperties? : boolean ;
673
+ patch ? : boolean | { addNewProperties? : boolean } ;
670
674
background? : boolean ;
671
675
}
672
676
```
673
677
674
- #### ` addNewProperties `
675
-
676
- If new properties that hasn't exist before, get added to the Item Value.
678
+ #### ` patch `
677
679
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.
678
683
``` ts {2}
679
684
MY_COLLECTION .collect ({id: 1 , name: " jeff" });
680
- 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"}'
681
686
MY_COLLECTION .update (1 , {name: " frank" , age: 10 }); // Item at '1' has value '{name: "frank", age: 10}'
682
687
```
683
688
@@ -702,4 +707,41 @@ MY_COLLECTION.update(1, {name: "frank"}, {background: true});
702
707
703
708
| Type | Default | Required |
704
709
| --------------------------| -----------| ----------|
705
- | ` boolean ` | false | No |
710
+ | ` boolean ` | false | No |
711
+
712
+
713
+
714
+ <br />
715
+
716
+ ---
717
+
718
+ <br />
719
+
720
+
721
+
722
+ ## ` HasConfig `
723
+
724
+ This is the ` HasConfig ` Interface, and it is used as config object in methods like ` hasGroup ` , ` hasSelector ` , .. Here is a Typescript
725
+ Interface of the Object for quick reference, however each property will be explained in more detail below.
726
+
727
+ ``` ts
728
+ export interface HasConfigInterface {
729
+ notExisting? : boolean ;
730
+ }
731
+ ```
732
+
733
+ #### ` notExisting `
734
+
735
+ Should be set to ` true ` , if also not existing Instances should be returned, like ` placeholder ` Instances.
736
+
737
+ ``` ts {2,5}
738
+ // Returns placeholder Group
739
+ MY_COLLECTION .hasGroup (' myPlaceholderGroup' , {notExisting: true });
740
+
741
+ // Returns undefined
742
+ MY_COLLECTION .hasGroup (' myPlaceholderGroup' );
743
+ ```
744
+
745
+ | Type | Default | Required |
746
+ | --------------------------| -----------| ----------|
747
+ | ` boolean ` | false | No |
0 commit comments