@jdeighan/coffee-utils 7.0.15 → 7.0.18

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.15",
4
+ "version": "7.0.18",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -52,6 +52,6 @@
52
52
  "svelte": "^3.47.0"
53
53
  },
54
54
  "devDependencies": {
55
- "@jdeighan/unit-tester": "^1.0.5"
55
+ "@jdeighan/unit-tester": "^2.0.0"
56
56
  }
57
57
  }
@@ -382,8 +382,8 @@ export strcat = (lItems...) ->
382
382
 
383
383
  # ---------------------------------------------------------------------------
384
384
 
385
- export replaceVars = (line, hVars={}, regexp=/__(env\.)?([A-Za-z_]\w*)__/) ->
385
+ export replaceVars = (line, hVars={}, rx=/__(env\.)?([A-Za-z_]\w*)__/g) ->
386
386
 
387
387
  replacerFunc = (match, prefix, name) =>
388
388
  return if prefix then process.env[name] else hVars[name].toString()
389
- return line.replace(regexp, replacerFunc)
389
+ return line.replace(rx, replacerFunc)
@@ -410,7 +410,7 @@ export var strcat = function(...lItems) {
410
410
  };
411
411
 
412
412
  // ---------------------------------------------------------------------------
413
- export var replaceVars = function(line, hVars = {}, regexp = /__(env\.)?([A-Za-z_]\w*)__/) {
413
+ export var replaceVars = function(line, hVars = {}, rx = /__(env\.)?([A-Za-z_]\w*)__/g) {
414
414
  var replacerFunc;
415
415
  replacerFunc = (match, prefix, name) => {
416
416
  if (prefix) {
@@ -419,5 +419,5 @@ export var replaceVars = function(line, hVars = {}, regexp = /__(env\.)?([A-Za-z
419
419
  return hVars[name].toString();
420
420
  }
421
421
  };
422
- return line.replace(regexp, replacerFunc);
422
+ return line.replace(rx, replacerFunc);
423
423
  };
@@ -150,7 +150,7 @@ adjustStack = (str) ->
150
150
  export debug = (lArgs...) ->
151
151
 
152
152
  # --- We want to allow item to be undef. Therefore, we need to
153
- # distinguish between 1 arg sent vs. 2+ args sent
153
+ # distinguish between 1 arg sent vs. 2 args sent
154
154
  nArgs = lArgs.length
155
155
  assert (nArgs==1) || (nArgs==2), "debug(): #{nArgs} args"
156
156
  [label, item] = lArgs
@@ -172,6 +172,7 @@ export debug = (lArgs...) ->
172
172
  prefix: mainPre
173
173
  itemPrefix: auxPre
174
174
  }
175
+
175
176
  switch type
176
177
  when 'enter'
177
178
  log label, hOptions
@@ -184,7 +185,7 @@ export debug = (lArgs...) ->
184
185
  # --- don't repeat the label
185
186
  logItem undef, item, hOptions
186
187
  when 'string'
187
- if item
188
+ if (nArgs==2)
188
189
  logItem label, item, hOptions
189
190
  else
190
191
  log label, hOptions
@@ -163,7 +163,7 @@ adjustStack = function(str) {
163
163
  export var debug = function(...lArgs) {
164
164
  var auxPre, hEnv, hOptions, item, label, mainPre, nArgs, orgDebugging, trans, type;
165
165
  // --- We want to allow item to be undef. Therefore, we need to
166
- // distinguish between 1 arg sent vs. 2+ args sent
166
+ // distinguish between 1 arg sent vs. 2 args sent
167
167
  nArgs = lArgs.length;
168
168
  assert((nArgs === 1) || (nArgs === 2), `debug(): ${nArgs} args`);
169
169
  [label, item] = lArgs;
@@ -199,7 +199,7 @@ export var debug = function(...lArgs) {
199
199
  }
200
200
  break;
201
201
  case 'string':
202
- if (item) {
202
+ if (nArgs === 2) {
203
203
  logItem(label, item, hOptions);
204
204
  } else {
205
205
  log(label, hOptions);