@jdeighan/coffee-utils 7.0.13 → 7.0.16

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.13",
4
+ "version": "7.0.16",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -379,3 +379,11 @@ export strcat = (lItems...) ->
379
379
  for item in lItems
380
380
  str += item.toString()
381
381
  return str
382
+
383
+ # ---------------------------------------------------------------------------
384
+
385
+ export replaceVars = (line, hVars={}, rx=/__(env\.)?([A-Za-z_]\w*)__/g) ->
386
+
387
+ replacerFunc = (match, prefix, name) =>
388
+ return if prefix then process.env[name] else hVars[name].toString()
389
+ return line.replace(rx, replacerFunc)
@@ -408,3 +408,16 @@ export var strcat = function(...lItems) {
408
408
  }
409
409
  return str;
410
410
  };
411
+
412
+ // ---------------------------------------------------------------------------
413
+ export var replaceVars = function(line, hVars = {}, rx = /__(env\.)?([A-Za-z_]\w*)__/g) {
414
+ var replacerFunc;
415
+ replacerFunc = (match, prefix, name) => {
416
+ if (prefix) {
417
+ return process.env[name];
418
+ } else {
419
+ return hVars[name].toString();
420
+ }
421
+ };
422
+ return line.replace(rx, replacerFunc);
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
  }