pacc 9.2.9 → 9.2.11
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 +1 -1
- package/src/ast.mjs +2 -2
- package/src/expand.mjs +26 -26
package/package.json
CHANGED
package/src/ast.mjs
CHANGED
|
@@ -49,10 +49,10 @@ export function keyedAccessEval(node, current, context) {
|
|
|
49
49
|
if (current === undefined) {
|
|
50
50
|
return undefined;
|
|
51
51
|
}
|
|
52
|
-
if (current
|
|
52
|
+
if (typeof current.get === 'function') {
|
|
53
53
|
return plain(current.get(node.key));
|
|
54
54
|
}
|
|
55
|
-
if (current
|
|
55
|
+
if (typeof current.has === 'function') {
|
|
56
56
|
return current.has(node.key) ? node.key : undefined;
|
|
57
57
|
}
|
|
58
58
|
if (current instanceof Iterator) {
|
package/src/expand.mjs
CHANGED
|
@@ -108,32 +108,6 @@ export function expand(object, context) {
|
|
|
108
108
|
return object;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
if (object instanceof Map) {
|
|
112
|
-
const r = new object.constructor();
|
|
113
|
-
for (const [key, value] of object.entries()) {
|
|
114
|
-
const path2 = [
|
|
115
|
-
...path,
|
|
116
|
-
{
|
|
117
|
-
key,
|
|
118
|
-
value
|
|
119
|
-
}
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
r.set(_expand(key, path2), _expand(value, path2));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return r;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (object instanceof Set) {
|
|
129
|
-
const r = new object.constructor();
|
|
130
|
-
for (const value of object.values()) {
|
|
131
|
-
r.add(_expand(value, [...path, { value }]));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return r;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
111
|
if (Array.isArray(object)) {
|
|
138
112
|
const array = new Array(object.length);
|
|
139
113
|
|
|
@@ -156,6 +130,32 @@ export function expand(object, context) {
|
|
|
156
130
|
return array;
|
|
157
131
|
}
|
|
158
132
|
|
|
133
|
+
if (typeof object.add === "function") {
|
|
134
|
+
const r = new object.constructor();
|
|
135
|
+
for (const value of object.values()) {
|
|
136
|
+
r.add(_expand(value, [...path, { value }]));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return r;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (typeof object.entries === "function") {
|
|
143
|
+
const r = new object.constructor();
|
|
144
|
+
for (const [key, value] of object.entries()) {
|
|
145
|
+
const path2 = [
|
|
146
|
+
...path,
|
|
147
|
+
{
|
|
148
|
+
key,
|
|
149
|
+
value
|
|
150
|
+
}
|
|
151
|
+
];
|
|
152
|
+
|
|
153
|
+
r.set(_expand(key, path2), _expand(value, path2));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return r;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
159
|
if (context.stopClass && object instanceof context.stopClass) {
|
|
160
160
|
return object;
|
|
161
161
|
}
|