@ronin/compiler 0.11.0-leo-ron-1083-experimental-225 → 0.11.0-leo-ron-1083-experimental-227
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +9 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -131,20 +131,14 @@ var expand = (obj) => {
|
|
131
131
|
var getProperty = (obj, path) => {
|
132
132
|
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
133
133
|
};
|
134
|
-
var
|
135
|
-
|
136
|
-
if (
|
137
|
-
const result = Number.parseInt(value);
|
138
|
-
return Number.isNaN(result) ? def : result;
|
139
|
-
};
|
140
|
-
var setProperty = (initial, path, value) => {
|
141
|
-
if (!initial) return setProperty({}, path, value);
|
142
|
-
if (!path || value === void 0) return initial;
|
134
|
+
var setProperty = (obj, path, value) => {
|
135
|
+
if (!obj) return setProperty({}, path, value);
|
136
|
+
if (!path || value === void 0) return obj;
|
143
137
|
const segments = path.split(/[.[\]]/g).filter((x) => !!x.trim());
|
144
138
|
const _set = (node) => {
|
145
139
|
if (segments.length > 1) {
|
146
140
|
const key = segments.shift();
|
147
|
-
const nextIsNum =
|
141
|
+
const nextIsNum = !Number.isNaN(Number.parseInt(segments[0]));
|
148
142
|
if (typeof node[key] !== "object" || node[key] === null) {
|
149
143
|
node[key] = nextIsNum ? [] : {};
|
150
144
|
}
|
@@ -153,7 +147,7 @@ var setProperty = (initial, path, value) => {
|
|
153
147
|
node[segments[0]] = value;
|
154
148
|
}
|
155
149
|
};
|
156
|
-
const cloned = structuredClone(
|
150
|
+
const cloned = structuredClone(obj);
|
157
151
|
_set(cloned);
|
158
152
|
return cloned;
|
159
153
|
};
|
@@ -1622,16 +1616,16 @@ var Transaction = class {
|
|
1622
1616
|
newValue = Boolean(value);
|
1623
1617
|
}
|
1624
1618
|
const parentFieldSlug = field.parentField;
|
1619
|
+
let usableRowIndex = rowIndex;
|
1625
1620
|
if (parentFieldSlug) {
|
1626
1621
|
if (rows.length === 1) {
|
1627
1622
|
newSlug = `${parentFieldSlug}.${field.slug}`;
|
1628
1623
|
} else {
|
1629
|
-
|
1630
|
-
|
1631
|
-
continue;
|
1624
|
+
newSlug = `${parentFieldSlug}[${rowIndex}].${field.slug}`;
|
1625
|
+
usableRowIndex = 0;
|
1632
1626
|
}
|
1633
1627
|
}
|
1634
|
-
records[
|
1628
|
+
records[usableRowIndex] = setProperty(records[usableRowIndex], newSlug, newValue);
|
1635
1629
|
}
|
1636
1630
|
}
|
1637
1631
|
return single ? records[0] : records;
|
package/package.json
CHANGED