Skip to content

Commit

Permalink
optimized "remove" by using __in__ instead of hasOwnProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Mar 28, 2014
1 parent f3b1838 commit 22cd6d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion std/flash/_std/haxe/ds/IntMap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ package haxe.ds;
}

public function remove( key : Int ) : Bool {
if( untyped !h.hasOwnProperty(key) ) return false;
if( !exists(key) ) return false;
untyped __delete__(h,key);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion std/flash/_std/haxe/ds/StringMap.hx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package haxe.ds;

public function remove( key : String ) : Bool {
key = "$"+key;
if( untyped !h.hasOwnProperty(key) ) return false;
if( untyped !__in__(key,h) ) return false;
untyped __delete__(h,key);
return true;
}
Expand Down

0 comments on commit 22cd6d4

Please sign in to comment.