about summary refs log tree commit diff stats
path: root/src/html/script.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-11-28 17:44:40 +0100
committerbptato <nincsnevem662@gmail.com>2024-11-28 17:44:40 +0100
commitbd38cbbc7068737214129cc5365ee8d4bfecda9c (patch)
treeda9d6f772eea3e8def9d58c1a5afd568375b2d7a /src/html/script.nim
parent46abcd79d5422261cc349cc0b4981357d5ae2fcd (diff)
downloadchawan-bd38cbbc7068737214129cc5365ee8d4bfecda9c.tar.gz
twtstr: add mypairs
This couldn't get into system.nim for technical reasons, but it's still
pretty useful when iterating over non-mutable openArrays.
Diffstat (limited to 'src/html/script.nim')
-rw-r--r--src/html/script.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/html/script.nim b/src/html/script.nim
index 2e009503..2d77c312 100644
--- a/src/html/script.nim
+++ b/src/html/script.nim
@@ -2,6 +2,7 @@ import monoucha/javascript
 import monoucha/quickjs
 import types/referrer
 import types/url
+import utils/twtstr
 
 type
   ParserMetadata* = enum
@@ -84,7 +85,7 @@ var errorImpl*: proc(ctx: JSContext; ss: varargs[string]) {.nimcall.}
 
 proc find*(moduleMap: ModuleMap; url: URL; moduleType: string): int =
   let surl = $url
-  for i, entry in moduleMap:
+  for i, entry in moduleMap.mypairs:
     if entry.key.moduleType == moduleType and entry.key.url == surl:
       return i
   return -1