tarsec 0.0.19 → 0.0.20

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.
Files changed (2) hide show
  1. package/dist/trace.js +4 -1
  2. package/package.json +2 -2
package/dist/trace.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { escape, round, shorten } from "./utils.js";
2
2
  import process from "process";
3
+ const isNode = typeof process !== "undefined" &&
4
+ process.versions != null &&
5
+ process.versions.node != null;
3
6
  const STEP = 2;
4
7
  /**
5
8
  * This function is used internally by the `trace` function to create the string for each step.
@@ -16,7 +19,7 @@ export function resultToString(name, result) {
16
19
  let level = 0;
17
20
  let counts = {};
18
21
  let times = {};
19
- let debugFlag = !!process.env.DEBUG;
22
+ let debugFlag = isNode ? !!process.env.DEBUG : false;
20
23
  let stepCount = 0;
21
24
  let stepLimit = -1;
22
25
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsec",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "A parser combinator library for TypeScript, inspired by Parsec.",
5
5
  "homepage": "https://github.com/egonSchiele/tarsec",
6
6
  "scripts": {
@@ -38,4 +38,4 @@
38
38
  "typescript": "^5.4.2",
39
39
  "vitest": "^1.4.0"
40
40
  }
41
- }
41
+ }