iconograph-ui 1.2.4 → 1.2.5

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.
@@ -8,12 +8,28 @@
8
8
 
9
9
  let waiting = false;
10
10
 
11
+ function setDeep(obj, path, value) {
12
+ let keys = path
13
+ .replace(/\]/g, '') // supprime les `]`
14
+ .split(/\[/); // découpe sur `[`
15
+
16
+ let current = obj;
17
+ keys.forEach((k, i) => {
18
+ if (i === keys.length - 1) {
19
+ current[k] = value;
20
+ } else {
21
+ if (!(k in current)) current[k] = {};
22
+ current = current[k];
23
+ }
24
+ });
25
+ }
26
+
11
27
  async function handleSubmit() {
12
28
  waiting = true;
13
29
  let body = {};
14
30
 
15
31
  inputs.forEach(i => {
16
- body[i.props.name] = i.value;
32
+ setDeep(body, i.props.name, i.value);
17
33
  });
18
34
 
19
35
  console.log(body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iconograph-ui",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "A Svelte Kit components library",
5
5
  "main": "./index.js",
6
6
  "svelte": "./index.js",