Skip to content

Instantly share code, notes, and snippets.

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