@jdeighan/coffee-utils 7.0.13 → 7.0.16
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/coffee_utils.coffee +8 -0
- package/src/coffee_utils.js +13 -0
- package/src/log_utils.coffee +1 -1
- package/src/log_utils.js +1 -1
package/package.json
CHANGED
package/src/coffee_utils.coffee
CHANGED
@@ -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)
|
package/src/coffee_utils.js
CHANGED
@@ -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
|
+
};
|
package/src/log_utils.coffee
CHANGED
package/src/log_utils.js
CHANGED