Skip to content

Commit

Permalink
* Adding Object.contains and Object.keyOf
Browse files Browse the repository at this point in the history
  • Loading branch information
cpojer committed Feb 5, 2011
1 parent d7189e4 commit 38c17a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Source/Types/Object.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ Object.extend({
if (object.hasOwnProperty(key)) values.push(object[key]);
}
return values;
},

keyOf: function(object, value){
for (var key in object){
if (object.hasOwnProperty(key) && object[key] === value) return key;
}
return null;
},

contains: function(object, value){
return Object.keyOf(object, value) != null;
}

});
2 changes: 1 addition & 1 deletion Specs
Submodule Specs updated 1 files
+158 −0 2.0base/Types/Object.js

0 comments on commit 38c17a9

Please sign in to comment.