@jdeighan/coffee-utils 7.0.68 → 7.0.69

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.68",
4
+ "version": "7.0.69",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -34,6 +34,12 @@ export class CallStack
34
34
 
35
35
  # ........................................................................
36
36
 
37
+ indent: () ->
38
+
39
+ return ' '.repeat(@lStack.length)
40
+
41
+ # ........................................................................
42
+
37
43
  enter: (funcName, lArgs=[], isLogged) ->
38
44
  # --- funcName might be <object>.<method>
39
45
 
@@ -41,7 +47,7 @@ export class CallStack
41
47
  assert isBoolean(isLogged), "missing isLogged"
42
48
 
43
49
  if doDebugStack
44
- LOG "[--> ENTER #{funcName}]"
50
+ LOG @indent() + "[--> ENTER #{funcName}]"
45
51
 
46
52
  lMatches = funcName.match(///^
47
53
  ([A-Za-z_][A-Za-z0-9_]*)
@@ -94,7 +100,7 @@ export class CallStack
94
100
  returnFrom: (fName) ->
95
101
 
96
102
  if doDebugStack
97
- LOG "[<-- BACK #{fName}]"
103
+ LOG @indent() + "[<-- BACK #{fName}]"
98
104
 
99
105
  if @lStack.length == 0
100
106
  LOG "ERROR: returnFrom('#{fName}') but stack is empty"
package/src/call_stack.js CHANGED
@@ -39,6 +39,11 @@ export var CallStack = class CallStack {
39
39
  this.lStack = [];
40
40
  }
41
41
 
42
+ // ........................................................................
43
+ indent() {
44
+ return ' '.repeat(this.lStack.length);
45
+ }
46
+
42
47
  // ........................................................................
43
48
  enter(funcName, lArgs = [], isLogged) {
44
49
  var _, hStackItem, ident1, ident2, lMatches;
@@ -46,7 +51,7 @@ export var CallStack = class CallStack {
46
51
  assert(isArray(lArgs), "missing lArgs");
47
52
  assert(isBoolean(isLogged), "missing isLogged");
48
53
  if (doDebugStack) {
49
- LOG(`[--> ENTER ${funcName}]`);
54
+ LOG(this.indent() + `[--> ENTER ${funcName}]`);
50
55
  }
51
56
  lMatches = funcName.match(/^([A-Za-z_][A-Za-z0-9_]*)(?:\.([A-Za-z_][A-Za-z0-9_]*))?$/);
52
57
  assert(defined(lMatches), `Bad funcName: ${OL(funcName)}`);
@@ -98,7 +103,7 @@ export var CallStack = class CallStack {
98
103
  returnFrom(fName) {
99
104
  var fullName, isLogged;
100
105
  if (doDebugStack) {
101
- LOG(`[<-- BACK ${fName}]`);
106
+ LOG(this.indent() + `[<-- BACK ${fName}]`);
102
107
  }
103
108
  if (this.lStack.length === 0) {
104
109
  LOG(`ERROR: returnFrom('${fName}') but stack is empty`);