@rickard.antonsson/ts-utility 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -32
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -71,39 +71,39 @@ Optionally use a function to modify current value.
71
71
 
72
72
  ```typescript
73
73
  it('should add 10 gold, 10 silver and 10 copper to persons pouch', () => {
74
- const person = {
75
- personal: {
76
- firstName: 'Test',
77
- lastName: 'Testsson',
78
- },
79
- items: {
80
- pouch: {color: 'blue', contents: {gold: 10, silver: 20, copper: 30}},
81
- },
82
- };
83
-
84
- const result = deepPartialSet(person, {
85
- items: {
86
- pouch: {
87
- contents: {
88
- gold: i => i + 10,
89
- silver: i => i + 10,
90
- copper: i => i + 10,
91
- },
74
+ const person = {
75
+ personal: {
76
+ firstName: 'Test',
77
+ lastName: 'Testsson',
78
+ },
79
+ items: {
80
+ pouch: {color: 'blue', contents: {gold: 10, silver: 20, copper: 30}},
81
+ },
82
+ };
83
+
84
+ const result = deepPartialSet(person, {
85
+ items: {
86
+ pouch: {
87
+ contents: {
88
+ gold: i => i + 10,
89
+ silver: i => i + 10,
90
+ copper: i => i + 10,
92
91
  },
93
92
  },
94
- });
95
-
96
- expect(result.items.pouch.contents).toEqual({
97
- gold: 20,
98
- silver: 30,
99
- copper: 40,
100
- });
101
- // Keep unchanged objects
102
- expect(result.personal).toBe(person.personal);
103
- // New objects for the complete tree where a child has a change
104
- expect(result).not.toBe(person);
105
- expect(result.items).not.toBe(person.items);
106
- expect(result.items.pouch).not.toBe(person.items.pouch);
107
- expect(result.items.pouch.contents).not.toBe(person.items.pouch.contents);
93
+ },
108
94
  });
95
+
96
+ expect(result.items.pouch.contents).toEqual({
97
+ gold: 20,
98
+ silver: 30,
99
+ copper: 40,
100
+ });
101
+ // Keep unchanged objects
102
+ expect(result.personal).toBe(person.personal);
103
+ // New objects for the complete tree where a child has a change
104
+ expect(result).not.toBe(person);
105
+ expect(result.items).not.toBe(person.items);
106
+ expect(result.items.pouch).not.toBe(person.items.pouch);
107
+ expect(result.items.pouch.contents).not.toBe(person.items.pouch.contents);
108
+ });
109
109
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rickard.antonsson/ts-utility",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "build/src/index.js",
6
6
  "types": "build/src/index.d.ts",