toolbox-x 1.0.1-rc.6 → 1.1.0

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.
package/README.md CHANGED
@@ -192,17 +192,22 @@ getColorForInitial('Banana', 50); // '#00376E80' (50% opacity)
192
192
  ```typescript
193
193
  import { createFormData } from 'toolbox-x/dom';
194
194
 
195
- const formData = createFormData({
195
+ const file1 = new File(['file1'], 'file1.txt', { type: 'application/text' });
196
+ const file2 = new File(['file2'], 'file2.txt', { type: 'application/text' });
197
+
198
+ const user = {
196
199
  user: {
197
200
  name: ' John Doe ',
198
201
  age: 30,
199
202
  preferences: { theme: 'dark' }
200
203
  },
201
204
  files: [file1, file2]
202
- }, {
205
+ };
206
+
207
+ const formData = createFormData(user, {
203
208
  trimStrings: true,
204
209
  lowerCaseValues: ['user.name'],
205
- dotNotateNested: ['user.preferences'],
210
+ dotNotateNested: ['user'],
206
211
  breakArray: ['files']
207
212
  });
208
213
 
@@ -230,10 +235,10 @@ const user = {
230
235
  tags: [],
231
236
  };
232
237
 
233
- sanitizeData(user, { ignoreNullish: true, ignoreEmpty: true });
238
+ sanitizeData(user, { ignoreFalsy: true, ignoreEmpty: true });
234
239
  // Returns { name: "John Doe", address: { city: "NYC" } } with exact input type which may cause issue when accessing missing properties
235
240
 
236
- sanitizeData(user, { ignoreNullish: true, ignoreEmpty: true }, 'partial');
241
+ sanitizeData(user, { ignoreFalsy: true, ignoreEmpty: true }, 'partial');
237
242
  // Return type: $DeepPartial<typeof user> safe property access by making all the properties (nested objects/arrays) optional
238
243
  // Returns { name: "John Doe", address: { city: "NYC" } }
239
244
  ```