svghmi/pythonic.js
changeset 3594 30f7eade322f
parent 3485 5f417d3c2d03
--- a/svghmi/pythonic.js	Fri Aug 19 10:22:16 2022 +0200
+++ b/svghmi/pythonic.js	Tue Aug 23 12:19:44 2022 +0200
@@ -165,8 +165,11 @@
 }
 
 const _zip = longest => (...iterables) => {
-    if (iterables.length < 2) {
-        throw new TypeError("zip takes 2 iterables at least, "+iterables.length+" given");
+    if (iterables.length == 0) {
+        // works starting with 1 iterable
+        // [a,b,c] -> [[a],[b],[c]]
+        // [a,b,c],[d,e,f] -> [[a,d],[b,e],[c,f]]
+        throw new TypeError("zip takes 1 iterables at least, "+iterables.length+" given");
     }
 
     return new Iterator(function * () {