From fb4f674d7f2d8caa4b5e5289bd0edd5cd24ebaf3 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Tue, 10 Aug 2021 11:05:06 -0400 Subject: [PATCH] Freeze does nothing if process is undefined --- lib/freeze.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/freeze.js b/lib/freeze.js index 4f7dd64..918d43e 100644 --- a/lib/freeze.js +++ b/lib/freeze.js @@ -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 }