Add dangerously_never_freeze option (#59)

process.env.UPDEEP_MODE
This commit is contained in:
Gil Birman 2016-05-30 14:37:41 -07:00 committed by Aaron Jensen
parent fce13afbf6
commit 8894f26ce2

View File

@ -26,7 +26,10 @@ function recur(object) {
* Deeply freeze a plain javascript object.
*
* If `process.env.NODE_ENV === 'production'`, this returns the original object
* witout freezing.
* without freezing.
*
* Or if `process.env.UPDEEP_MODE === 'dangerously_never_freeze'`, this returns the original object
* without freezing.
*
* @function
* @sig a -> a
@ -38,6 +41,10 @@ function freeze(object) {
return object;
}
if (process.env.UPDEEP_MODE === 'dangerously_never_freeze') {
return object;
}
if (needsFreezing(object)) {
recur(object);
}