diff --git a/src/main/java/me/topchetoeu/jscript/runtime/values/objects/ArrayValue.java b/src/main/java/me/topchetoeu/jscript/runtime/values/objects/ArrayValue.java index 6b3f457..765cd8a 100644 --- a/src/main/java/me/topchetoeu/jscript/runtime/values/objects/ArrayValue.java +++ b/src/main/java/me/topchetoeu/jscript/runtime/values/objects/ArrayValue.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; +import java.util.stream.Stream; import me.topchetoeu.jscript.common.environment.Environment; import me.topchetoeu.jscript.runtime.values.Value; @@ -72,6 +73,9 @@ public class ArrayValue extends ArrayLikeValue implements Iterable { copyTo(res, 0, 0, size); return res; } + public Stream stream() { + return Arrays.stream(toArray()); + } public void copyTo(Value[] arr, int sourceStart, int destStart, int count) { var nullFill = Math.max(0, arr.length - size - destStart);