diff options
author | kitsunyan | 2018-03-16 15:31:18 +0000 |
---|---|---|
committer | kitsunyan | 2018-03-16 15:31:18 +0000 |
commit | de2164726d1d80fd41996db164eae932adef0807 (patch) | |
tree | 5782db6b07eb85b878d6e07c75b718cdebbe9b06 /src/utils.nim | |
parent | 864cc0373fd6095295f68cc44d1657bd17269732 (diff) |
Take pkgname change into account
Diffstat (limited to 'src/utils.nim')
-rw-r--r-- | src/utils.nim | 10 |
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): |