Freeze does nothing if process is undefined

main
Aaron Jensen 2021-08-10 11:05:06 -04:00
parent 4b5032e101
commit fb4f674d7f
No known key found for this signature in database
GPG Key ID: C7481C94F4CA86A7
1 changed files with 6 additions and 0 deletions

View File

@ -32,12 +32,18 @@ function recur(object) {
* Or if `process.env.UPDEEP_MODE === 'dangerously_never_freeze'`, this returns the original object
* without freezing.
*
* If in a browser and built without replacing process, never freeze.
*
* @function
* @sig a -> a
* @param {object} object Object to freeze.
* @return {object} Frozen object, unless in production, then the same object.
*/
function freeze(object) {
if (typeof process === 'undefined') {
return object
}
if (process.env.NODE_ENV === 'production') {
return object
}