Clean up process globals
Summary: Cleaned up some `process` references Reviewed By: passy Differential Revision: D33184882 fbshipit-source-id: 6fc56bcea4e145ba97aa8bf9e689e53e2bf239cc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e46fcba0b2
commit
4630f37786
@@ -7,6 +7,8 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {isProduction} from 'flipper-common';
|
||||
|
||||
/**
|
||||
* makeShallowSerializable will prepare common data structures, like Map and Set, for JSON serialization.
|
||||
* However, this will happen only for the root object and not recursively to keep things efficiently.
|
||||
@@ -66,18 +68,12 @@ export function deserializeShallowObject(obj: any): any {
|
||||
return obj;
|
||||
}
|
||||
|
||||
// TODO: introduce a isProduction utility!
|
||||
declare const process: any;
|
||||
|
||||
/**
|
||||
* Asserts a value is JSON serializable.
|
||||
* Will print a warning if a value is JSON serializable, but isn't a pure tree
|
||||
*/
|
||||
export function assertSerializable(obj: any) {
|
||||
if (
|
||||
typeof process === 'undefined' ||
|
||||
(process.env.NODE_ENV !== 'test' && process.env.NODE_ENV !== 'development')
|
||||
) {
|
||||
if (isProduction()) {
|
||||
return;
|
||||
}
|
||||
// path to current object
|
||||
|
||||
Reference in New Issue
Block a user