@jdeighan/coffee-utils 7.0.14 → 7.0.17

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.14",
4
+ "version": "7.0.17",
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,14 +382,8 @@ export strcat = (lItems...) ->
382
382
 
383
383
  # ---------------------------------------------------------------------------
384
384
 
385
- export replaceVars = (line, hVars) ->
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
-
390
- return line.replace(///
391
- __
392
- (env\.)?
393
- ([A-Za-z_]\w*)
394
- __
395
- ///g, 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) {
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) {
419
419
  return hVars[name].toString();
420
420
  }
421
421
  };
422
- return line.replace(/__(env\.)?([A-Za-z_]\w*)__/g, replacerFunc);
422
+ return line.replace(rx, replacerFunc);
423
423
  };
@@ -28,7 +28,7 @@ export LOG = (lArgs...) ->
28
28
  console.log sep_dash
29
29
  console.log "#{label}:"
30
30
  if isString(item)
31
- console.log item
31
+ console.log untabify(item)
32
32
  else
33
33
  console.log untabify(orderedStringify(item))
34
34
  console.log sep_dash
package/src/log_utils.js CHANGED
@@ -45,7 +45,7 @@ export var LOG = function(...lArgs) {
45
45
  console.log(sep_dash);
46
46
  console.log(`${label}:`);
47
47
  if (isString(item)) {
48
- console.log(item);
48
+ console.log(untabify(item));
49
49
  } else {
50
50
  console.log(untabify(orderedStringify(item)));
51
51
  }