aboutsummaryrefslogtreecommitdiff
path: root/src/utils.nim
diff options
context:
space:
mode:
authorkitsunyan2018-03-16 15:31:18 +0000
committerkitsunyan2018-03-16 15:31:18 +0000
commitde2164726d1d80fd41996db164eae932adef0807 (patch)
tree5782db6b07eb85b878d6e07c75b718cdebbe9b06 /src/utils.nim
parent864cc0373fd6095295f68cc44d1657bd17269732 (diff)
Take pkgname change into account
Diffstat (limited to 'src/utils.nim')
-rw-r--r--src/utils.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/utils.nim b/src/utils.nim
index 8316110..288cf44 100644
--- a/src/utils.nim
+++ b/src/utils.nim
@@ -67,9 +67,13 @@ iterator enumerate*[T: enum]: T =
for i in elow .. ehigh:
yield T(i)
-iterator namedPairs*[K, V](table: Table[K, V]): tuple[key: K, value: V] =
- for key, value in table.pairs:
- yield (key, value)
+template namedPairsTyped(T: typedesc) =
+ iterator namedPairs*[K, V](table: T[K, V]): tuple[key: K, value: V] =
+ for key, value in table.pairs:
+ yield (key, value)
+
+namedPairsTyped(Table)
+namedPairsTyped(OrderedTable)
iterator reversed*[T](s: openArray[T]): T =
for i in countdown(s.len - 1, 0):