@carbonorm/carbonnode 3.0.11 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,7 @@ export function checkCache<ResponseDataType = any, RestShortTableNames = string>
45
45
 
46
46
  if (true === cacheResult?.final) {
47
47
 
48
- if (false === isTest || true === isVerbose) {
48
+ if (false === isTest() || true === isVerbose()) {
49
49
 
50
50
  console.groupCollapsed('%c API: Rest api cache (' + requestMethod + ' ' + tableName + ') has reached the final result. Returning undefined!', 'color: #cc0')
51
51
 
@@ -4,14 +4,14 @@ import isVerbose from "variables/isVerbose";
4
4
  * Conditionally group a log if verbose.
5
5
  */
6
6
  export function group(title: string, data?: any): void {
7
- if (!isVerbose) return;
7
+ if (!isVerbose()) return;
8
8
  console.groupCollapsed(`%c${title}`, "color: #007acc");
9
9
  if (data !== undefined) console.log(data);
10
10
  console.groupEnd();
11
11
  }
12
12
 
13
13
  export function info(message: string, ...optional: any[]): void {
14
- if (!isVerbose) return;
14
+ if (!isVerbose()) return;
15
15
  console.info(`%cINFO: ${message}`, "color: #0a0", ...optional);
16
16
  }
17
17
 
@@ -3,9 +3,9 @@ import { toastOptions, toastOptionsDevs } from "variables/toastOptions";
3
3
  import isLocal from "variables/isLocal";
4
4
 
5
5
  export function onSuccess(message: string): void {
6
- toast.success(message, isLocal ? toastOptionsDevs : toastOptions);
6
+ toast.success(message, isLocal() ? toastOptionsDevs : toastOptions);
7
7
  }
8
8
 
9
9
  export function onError(message: string): void {
10
- toast.error(message, isLocal ? toastOptionsDevs : toastOptions);
10
+ toast.error(message, isLocal() ? toastOptionsDevs : toastOptions);
11
11
  }
@@ -1,6 +1,7 @@
1
1
  import {getEnvVar} from "./getEnvVar";
2
2
 
3
3
 
4
- const isDevelopment = getEnvVar('NODE_ENV', '') === 'development';
5
4
 
6
- export default isDevelopment;
5
+ export default function () {
6
+ return getEnvVar('NODE_ENV', '') === 'development';
7
+ };
@@ -1,3 +1,12 @@
1
- const isNode = () => typeof process !== 'undefined' && !!process.versions?.node;
1
+ const isNode = () => {
2
+
3
+ console.log('Checking if running in Node.js environment...');
4
+
5
+ const isNodeEnv = typeof process !== 'undefined' && !!process.versions?.node;
6
+
7
+ console.log(`Is Node.js environment: ${isNodeEnv}`);
8
+
9
+ return isNodeEnv;
10
+ }
2
11
 
3
12
  export default isNode;
@@ -1,7 +1,8 @@
1
1
  import {getEnvVar} from "./getEnvVar";
2
2
 
3
- const isTest = getEnvVar('JEST_WORKER_ID') || getEnvVar('NODE_ENV') === 'test'
4
- || getEnvVar('REACT_APP_TEST') === 'true' || getEnvVar('VITE_TEST') === 'true'
5
- || getEnvVar('MODE') === 'test' || getEnvVar('VITE_TEST_MODE') === 'true';
6
3
 
7
- export default isTest;
4
+ export default function () {
5
+ return getEnvVar('JEST_WORKER_ID') || getEnvVar('NODE_ENV') === 'test'
6
+ || getEnvVar('REACT_APP_TEST') === 'true' || getEnvVar('VITE_TEST') === 'true'
7
+ || getEnvVar('MODE') === 'test' || getEnvVar('VITE_TEST_MODE') === 'true';
8
+ };
@@ -1,7 +1,6 @@
1
1
  import {getEnvVar} from "./getEnvVar";
2
2
 
3
- const envVerbose = getEnvVar('VERBOSE') || getEnvVar('REACT_APP_VERBOSE') || getEnvVar('VITE_VERBOSE') || ''
4
-
5
- const isVerbose = ['true', '1', 'yes', 'on'].includes(envVerbose.toLowerCase());
6
-
7
- export default isVerbose
3
+ export default function () {
4
+ const envVerbose = getEnvVar('VERBOSE') || getEnvVar('REACT_APP_VERBOSE') || getEnvVar('VITE_VERBOSE') || ''
5
+ return ['true', '1', 'yes', 'on'].includes(envVerbose.toLowerCase());
6
+ }