fill out the FuzzyMap API to match Map
This commit is contained in:
@@ -4,7 +4,7 @@ import haxe.ds.StringMap;
|
||||
|
||||
using hx.strings.Strings;
|
||||
|
||||
// TODO forward and implement the full Map API
|
||||
@:forward(clear, copy, iterator, keyValueIterator, keys, toString)
|
||||
abstract FuzzyMap<T>(StringMap<T>) from StringMap<T> to StringMap<T> {
|
||||
public inline function new(?m:StringMap<T>) {
|
||||
this = if (m != null) m else new StringMap<T>();
|
||||
@@ -60,6 +60,10 @@ abstract FuzzyMap<T>(StringMap<T>) from StringMap<T> to StringMap<T> {
|
||||
return this.remove(key);
|
||||
}
|
||||
|
||||
public inline function exists(fuzzySearchKey:String):Bool {
|
||||
return bestMatch(fuzzySearchKey, false) != null;
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function set(key:String, v:T):T {
|
||||
this.set(key, v);
|
||||
|
Reference in New Issue
Block a user