pacc 9.2.10 → 9.2.12
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/package.json +3 -2
- package/src/expand.mjs +35 -31
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
-
"packageManager": "npm@11.
|
|
8
|
+
"packageManager": "npm@11.16.0",
|
|
9
9
|
"types": "./types/module.d.mts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@mitata/counters": "^0.0.8",
|
|
46
|
+
"aggregated-map": "^1.0.3",
|
|
46
47
|
"ava": "^8.0.1",
|
|
47
48
|
"browser-ava": "^2.3.61",
|
|
48
49
|
"c8": "^11.0.0",
|
package/src/expand.mjs
CHANGED
|
@@ -103,63 +103,66 @@ export function expand(object, context) {
|
|
|
103
103
|
return object;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
if (object === null
|
|
107
|
-
// TODO: find a better way to identify special cases
|
|
106
|
+
if (object === null) {
|
|
108
107
|
return object;
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
if (object
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
if (Array.isArray(object)) {
|
|
111
|
+
const copy = new object.constructor[Symbol.species](object.length);
|
|
112
|
+
|
|
113
|
+
for (let index = 0; index < object.length; index++) {
|
|
114
|
+
const o = object[index];
|
|
115
|
+
const r = _expand(o, [
|
|
115
116
|
...path,
|
|
116
117
|
{
|
|
117
|
-
key,
|
|
118
|
-
value
|
|
118
|
+
key: index,
|
|
119
|
+
value: o
|
|
119
120
|
}
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
]);
|
|
122
|
+
if (r instanceof Promise) {
|
|
123
|
+
promises.push(r);
|
|
124
|
+
r.then(f => (copy[index] = f));
|
|
125
|
+
}
|
|
126
|
+
copy[index] = r;
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
return
|
|
129
|
+
return copy;
|
|
126
130
|
}
|
|
127
131
|
|
|
128
|
-
if (object
|
|
129
|
-
const
|
|
132
|
+
if (typeof object.add === "function") {
|
|
133
|
+
const copy = new object.constructor[Symbol.species]();
|
|
130
134
|
for (const value of object.values()) {
|
|
131
|
-
|
|
135
|
+
copy.add(_expand(value, [...path, { value }]));
|
|
132
136
|
}
|
|
133
137
|
|
|
134
|
-
return
|
|
138
|
+
return copy;
|
|
135
139
|
}
|
|
136
140
|
|
|
137
|
-
if (
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const o = object[index];
|
|
142
|
-
const r = _expand(o, [
|
|
141
|
+
if (typeof object.entries === "function") {
|
|
142
|
+
const copy = new object.constructor[Symbol.species]();
|
|
143
|
+
for (const [key, value] of object.entries()) {
|
|
144
|
+
const path2 = [
|
|
143
145
|
...path,
|
|
144
146
|
{
|
|
145
|
-
key
|
|
146
|
-
value
|
|
147
|
+
key,
|
|
148
|
+
value
|
|
147
149
|
}
|
|
148
|
-
]
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
r.then(f => (array[index] = f));
|
|
152
|
-
}
|
|
153
|
-
array[index] = r;
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
copy.set(_expand(key, path2), _expand(value, path2));
|
|
154
153
|
}
|
|
155
154
|
|
|
156
|
-
return
|
|
155
|
+
return copy;
|
|
157
156
|
}
|
|
158
157
|
|
|
159
158
|
if (context.stopClass && object instanceof context.stopClass) {
|
|
160
159
|
return object;
|
|
161
160
|
}
|
|
162
161
|
|
|
162
|
+
if (typeof object.valueOf === "function") {
|
|
163
|
+
return object;
|
|
164
|
+
}
|
|
165
|
+
|
|
163
166
|
let newObject = {};
|
|
164
167
|
|
|
165
168
|
for (let [key, value] of Object.entries(object)) {
|
|
@@ -182,6 +185,7 @@ export function expand(object, context) {
|
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
|
|
188
|
+
console.log(newObject);
|
|
185
189
|
return newObject;
|
|
186
190
|
}
|
|
187
191
|
|