pacc 9.2.11 → 9.2.13
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 +15 -12
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.13",
|
|
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,13 +103,12 @@ 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
110
|
if (Array.isArray(object)) {
|
|
112
|
-
const
|
|
111
|
+
const copy = new object.constructor[Symbol.species](object.length);
|
|
113
112
|
|
|
114
113
|
for (let index = 0; index < object.length; index++) {
|
|
115
114
|
const o = object[index];
|
|
@@ -122,25 +121,25 @@ export function expand(object, context) {
|
|
|
122
121
|
]);
|
|
123
122
|
if (r instanceof Promise) {
|
|
124
123
|
promises.push(r);
|
|
125
|
-
r.then(f => (
|
|
124
|
+
r.then(f => (copy[index] = f));
|
|
126
125
|
}
|
|
127
|
-
|
|
126
|
+
copy[index] = r;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
return
|
|
129
|
+
return copy;
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
if (typeof object.add === "function") {
|
|
134
|
-
const
|
|
133
|
+
const copy = new object.constructor[Symbol.species]();
|
|
135
134
|
for (const value of object.values()) {
|
|
136
|
-
|
|
135
|
+
copy.add(_expand(value, [...path, { value }]));
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
return
|
|
138
|
+
return copy;
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
if (typeof object.entries === "function") {
|
|
143
|
-
const
|
|
142
|
+
const copy = new object.constructor[Symbol.species]();
|
|
144
143
|
for (const [key, value] of object.entries()) {
|
|
145
144
|
const path2 = [
|
|
146
145
|
...path,
|
|
@@ -150,16 +149,20 @@ export function expand(object, context) {
|
|
|
150
149
|
}
|
|
151
150
|
];
|
|
152
151
|
|
|
153
|
-
|
|
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(Object.prototype.toString.call(object) !== '[object Object]') {
|
|
163
|
+
return object;
|
|
164
|
+
}
|
|
165
|
+
|
|
163
166
|
let newObject = {};
|
|
164
167
|
|
|
165
168
|
for (let [key, value] of Object.entries(object)) {
|