about summary refs log tree commit diff stats
path: root/src/data/idna.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-29 13:39:58 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-29 13:51:55 +0200
commit19068fd7d803a157de671e189e01731bc903ba9e (patch)
treeaae00bec40a00b67586373199cfe6d9789e19013 /src/data/idna.nim
parent1dd9eba6aba9760339fbef9bbd4244108fac2eab (diff)
downloadchawan-19068fd7d803a157de671e189e01731bc903ba9e.tar.gz
Factor out map search, remove sugar
Diffstat (limited to 'src/data/idna.nim')
-rw-r--r--src/data/idna.nim12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/data/idna.nim b/src/data/idna.nim
index 451792a2..a067a66f 100644
--- a/src/data/idna.nim
+++ b/src/data/idna.nim
@@ -2,9 +2,10 @@ import algorithm
 import unicode
 import sets
 import tables
-import sugar
 import strutils
 
+import utils/map
+
 type
   IDNATableStatus* = enum
     IDNA_VALID, IDNA_IGNORED, IDNA_MAPPED, IDNA_DEVIATION, IDNA_DISALLOWED
@@ -141,15 +142,6 @@ const (MappedMap,
        Ignored,
        Deviation) = loadStuff(IdnaMappingTable)
 
-func searchInMap[U, T](a: openarray[(U, T)], u: U): int =
-  binarySearch(a, u, (x, y) => cmp(x[0], y))
-
-func isInMap[U, T](a: openarray[(U, T)], u: U): bool =
-  a.searchInMap(u) != -1
-
-func isInRange[U](a: openarray[(U, U)], u: U): bool =
-  binarySearch(a, u, (x, y) => (if x[0] < y: -1 elif x[1] > y: 1 else: 0)) != -1
-
 func getIdnaTableStatus*(r: Rune): IDNATableStatus =
   let i = uint32(r)
   {.cast(noSideEffect).}: