Skip to content

Instantly share code, notes, and snippets.

@rkatic
Created February 17, 2010 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkatic/306155 to your computer and use it in GitHub Desktop.
Save rkatic/306155 to your computer and use it in GitHub Desktop.
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