From a3231b0e5c5f089464059ed03d9264a2440a07d2 Mon Sep 17 00:00:00 2001 From: Joe Pantazidis Date: Mon, 17 May 2021 21:54:33 +0200 Subject: [PATCH] fix: avoid depending on node `process` (#16) --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3598000..09b0765 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,8 +18,8 @@ const escaped: Record = { }; const objectProtoOwnPropertyNames = Object.getOwnPropertyNames(Object.prototype).sort().join('\0'); // workaround to disable warnings, see https://github.com/nuxt/nuxt.js/issues/4026 for details -const defaultLogLevel = process.env.NUXT_ENV_DEVALUE_LOG_LEVEL || 'warn'; -const logLimit = parseInt(process.env.NUXT_ENV_DEVALUE_LOG_LIMIT) || 99; +const defaultLogLevel = typeof process !== 'undefined' ? process.env.NUXT_ENV_DEVALUE_LOG_LEVEL || 'warn' : 'warn'; +const logLimit = typeof process !== 'undefined' ? parseInt(process.env.NUXT_ENV_DEVALUE_LOG_LIMIT) || 99 : 99; export default function devalue(value: any, level = defaultLogLevel) {