diff --git a/lib/util.js b/lib/util.js index 6651147..c257f8f 100644 --- a/lib/util.js +++ b/lib/util.js @@ -132,12 +132,13 @@ exports.clone = function( data ) } else if ( data instanceof Object ) { - var newobj = {}; + var newobj = {}, + hasOwn = Object.prototype.hasOwnProperty; // copy data to the new object for ( prop in data ) { - if ( data.hasOwnProperty( prop ) ) + if ( hasOwn.call( data, prop ) ) { newobj[ prop ] = data[ prop ]; } @@ -167,14 +168,16 @@ exports.propParse = function( data, options ) callback_prop = options.property || fvoid, callback_method = options.method || fvoid, callback_getter = options.getter || fvoid, - callback_setter = options.setter || fvoid; + callback_setter = options.setter || fvoid, + + hasOwn = Object.prototype.hasOwnProperty; // for each of the given properties, determine what type of property we're // dealing with (in the classic OO sense) for ( prop in data ) { // ignore properties of instance prototypes - if ( !( data.hasOwnProperty( prop ) ) ) + if ( !( hasOwn.call( data, prop ) ) ) { continue; }