@ronin/compiler 0.11.0-leo-ron-1083-experimental-225 → 0.11.0-leo-ron-1083-experimental-226
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/dist/index.js +5 -11
- 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
|
};
|
package/package.json
CHANGED