1
0
Fork 0

Simplified and enhanced util.freeze()

closure/master
Mike Gerwitz 2011-05-15 19:12:01 -04:00
parent 4c74f2a1f2
commit f47fcf4f46
1 changed files with 4 additions and 8 deletions

View File

@ -62,17 +62,13 @@ var can_define_prop = ( function()
* *
* @return {Object} object passed to function * @return {Object} object passed to function
*/ */
exports.freeze = function( obj ) exports.freeze = ( typeof Object.freeze === 'function' )
{ ? Object.freeze
// if freezing is not supported (ES5), do nothing : function( obj )
if ( Object.freeze === undefined )
{ {
return; return;
} }
;
Object.freeze( obj );
return obj;
};
/** /**