@jdeighan/coffee-utils 7.0.14 → 7.0.15
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 +2 -8
- package/src/coffee_utils.js +2 -2
- package/src/log_utils.coffee +1 -1
- package/src/log_utils.js +1 -1
package/package.json
CHANGED
package/src/coffee_utils.coffee
CHANGED
@@ -382,14 +382,8 @@ export strcat = (lItems...) ->
|
|
382
382
|
|
383
383
|
# ---------------------------------------------------------------------------
|
384
384
|
|
385
|
-
export replaceVars = (line, hVars) ->
|
385
|
+
export replaceVars = (line, hVars={}, regexp=/__(env\.)?([A-Za-z_]\w*)__/) ->
|
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(regexp, replacerFunc)
|
package/src/coffee_utils.js
CHANGED
@@ -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 = {}, regexp = /__(env\.)?([A-Za-z_]\w*)__/) {
|
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(
|
422
|
+
return line.replace(regexp, replacerFunc);
|
423
423
|
};
|
package/src/log_utils.coffee
CHANGED
package/src/log_utils.js
CHANGED