From 5b2125dc3acb2b26fe20fa02e9ee424a42f68095 Mon Sep 17 00:00:00 2001 From: "Lynn C. Rees" Date: Fri, 8 Sep 2017 11:09:58 -0600 Subject: Support `in` operator on StringTableRef --- lib/pure/strtabs.nim | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/pure/strtabs.nim') diff --git a/lib/pure/strtabs.nim b/lib/pure/strtabs.nim index 858043128..75c5e171d 100644 --- a/lib/pure/strtabs.nim +++ b/lib/pure/strtabs.nim @@ -138,6 +138,10 @@ proc hasKey*(t: StringTableRef, key: string): bool {.rtlFunc, extern: "nst$1".} ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 +proc contains*(t: StringTableRef, key: string): bool = + ## alias of `hasKey` for use with the `in` operator. + return hasKey(t, key) + proc rawInsert(t: StringTableRef, data: var KeyValuePairSeq, key, val: string) = var h: Hash = myhash(t, key) and high(data) while not isNil(data[h].key): -- cgit 1.4.1-2-gfad0