Freeze does nothing if process is undefined
This commit is contained in:
parent
4b5032e101
commit
fb4f674d7f
@ -32,12 +32,18 @@ function recur(object) {
|
|||||||
* Or if `process.env.UPDEEP_MODE === 'dangerously_never_freeze'`, this returns the original object
|
* Or if `process.env.UPDEEP_MODE === 'dangerously_never_freeze'`, this returns the original object
|
||||||
* without freezing.
|
* without freezing.
|
||||||
*
|
*
|
||||||
|
* If in a browser and built without replacing process, never freeze.
|
||||||
|
*
|
||||||
* @function
|
* @function
|
||||||
* @sig a -> a
|
* @sig a -> a
|
||||||
* @param {object} object Object to freeze.
|
* @param {object} object Object to freeze.
|
||||||
* @return {object} Frozen object, unless in production, then the same object.
|
* @return {object} Frozen object, unless in production, then the same object.
|
||||||
*/
|
*/
|
||||||
function freeze(object) {
|
function freeze(object) {
|
||||||
|
if (typeof process === 'undefined') {
|
||||||
|
return object
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
return object
|
return object
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user