summaryrefslogtreecommitdiff
path: root/src/eval/methods.rs
diff options
context:
space:
mode:
authorLaurenz Stampfl <47084093+LaurenzV@users.noreply.github.com>2023-04-25 11:22:20 +0200
committerGitHub <noreply@github.com>2023-04-25 11:22:20 +0200
commitf38989358e768ebe17c5f191cf9026d513e6f6b7 (patch)
tree1cc6f1637a824ab6471e7ca9550d44b4266d6cf4 /src/eval/methods.rs
parentd5d98b67a83944d72a5c0f8e8e2f43aeee667122 (diff)
Add a zip method to arrays (#947)
Diffstat (limited to 'src/eval/methods.rs')
-rw-r--r--src/eval/methods.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/eval/methods.rs b/src/eval/methods.rs
index 29b729cb..3ee4599c 100644
--- a/src/eval/methods.rs
+++ b/src/eval/methods.rs
@@ -118,6 +118,7 @@ pub fn call(
array.join(sep, last).at(span)?
}
"sorted" => Value::Array(array.sorted(vm, span, args.named("key")?)?),
+ "zip" => Value::Array(array.zip(args.expect("other")?)),
"enumerate" => Value::Array(array.enumerate()),
_ => return missing(),
},
@@ -319,6 +320,7 @@ pub fn methods_on(type_name: &str) -> &[(&'static str, bool)] {
("slice", true),
("sorted", false),
("enumerate", false),
+ ("zip", true),
],
"dictionary" => &[
("at", true),