Simplified and enhanced util.freeze()
parent
4c74f2a1f2
commit
f47fcf4f46
12
lib/util.js
12
lib/util.js
|
@ -62,17 +62,13 @@ var can_define_prop = ( function()
|
|||
*
|
||||
* @return {Object} object passed to function
|
||||
*/
|
||||
exports.freeze = function( obj )
|
||||
{
|
||||
// if freezing is not supported (ES5), do nothing
|
||||
if ( Object.freeze === undefined )
|
||||
exports.freeze = ( typeof Object.freeze === 'function' )
|
||||
? Object.freeze
|
||||
: function( obj )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Object.freeze( obj );
|
||||
return obj;
|
||||
};
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue