Skip to content

Instantly share code, notes, and snippets.

@rkatic
Created February 17, 2010 01:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
eachProperty
(function($){
var hasOwnProperty = Object.prototype.hasOwnProperty
$.eachProperty = function( obj, func, context ) {
for ( var i in obj ) {
// Own properties are enumerated firstly, so no need to continue on first not own.
if ( !hasOwnProperty.call(obj, i) || func.call( context, i, obj[i] ) === false ) {
break;
}
}
return obj;
}
})(jQuery || this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment