toolbox-x 1.0.1-rc.6 → 1.1.1
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 +10 -5
- package/dist/basics-1_M7UvCn.mjs +1320 -0
- package/dist/basics-K8BDSYD6.cjs +1505 -0
- package/dist/dom.cjs +37 -22
- package/dist/dom.d.cts +16 -16
- package/dist/dom.d.mts +16 -16
- package/dist/dom.mjs +36 -20
- package/dist/{form-0eq15CfC.d.cts → form-CY3RefN-.d.cts} +4 -6
- package/dist/{form-DMBHU578.d.mts → form-zhtuXugI.d.mts} +4 -6
- package/dist/{convert-IaWh6Wab.cjs → guards-0VjySrPM.cjs} +89 -1
- package/dist/{convert-C8LsoKmI.mjs → guards-DeO4ukiK.mjs} +54 -2
- package/dist/guards.cjs +29 -72
- package/dist/guards.d.cts +4 -4
- package/dist/guards.d.mts +4 -4
- package/dist/guards.mjs +3 -54
- package/dist/hash.cjs +58 -1262
- package/dist/hash.d.cts +2 -95
- package/dist/hash.d.mts +2 -95
- package/dist/hash.mjs +3 -1207
- package/dist/index.cjs +22 -22
- package/dist/index.mjs +3 -3
- package/dist/{objectify-DcVgoCP2.cjs → objectify-CRUYlTtI.cjs} +19 -24
- package/dist/{objectify-SEQ_bNug.mjs → objectify-DgkPCH_o.mjs} +20 -25
- package/dist/types/form.d.cts +1 -1
- package/dist/types/form.d.mts +1 -1
- package/dist/uuid-B5JYv6ao.d.cts +201 -0
- package/dist/uuid-DU64TmIe.d.mts +201 -0
- package/package.json +1 -1
- package/dist/basics-CYqqguZr.cjs +0 -132
- package/dist/basics-DQe9mP_M.mjs +0 -115
- package/dist/specials-B7y-9nk1.d.mts +0 -108
- package/dist/specials-Dmpu2l2b.d.cts +0 -108
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
|
|
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
|
|
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, {
|
|
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, {
|
|
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
|
```
|