pacc 9.2.0 → 9.2.2
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 +6 -0
- package/src/tokens.mjs +4 -0
package/package.json
CHANGED
package/src/ast.mjs
CHANGED
|
@@ -30,6 +30,12 @@ export function keyedAccessEval(node, current, context) {
|
|
|
30
30
|
return current.has(node.key) ? node.key : undefined;
|
|
31
31
|
}
|
|
32
32
|
if (current instanceof Iterator) {
|
|
33
|
+
if(typeof node.key === 'number') {
|
|
34
|
+
for(const item of current.drop(node.key)) {
|
|
35
|
+
return item;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
33
39
|
return current.map(item => item[node.key]);
|
|
34
40
|
}
|
|
35
41
|
|
package/src/tokens.mjs
CHANGED
|
@@ -393,6 +393,10 @@ export const globals = {
|
|
|
393
393
|
const data = evalOne(args[0], current, context);
|
|
394
394
|
const length = evalOne(args[1], current, context);
|
|
395
395
|
|
|
396
|
+
if(data instanceof Iterator) {
|
|
397
|
+
return data.take(length);
|
|
398
|
+
}
|
|
399
|
+
|
|
396
400
|
data.length = length;
|
|
397
401
|
return data;
|
|
398
402
|
}
|