@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 +2 -2
- 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
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "7.0.
|
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": "^
|
55
|
+
"@jdeighan/unit-tester": "^2.0.0"
|
56
56
|
}
|
57
57
|
}
|
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={}, 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)
|
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 = {}, 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(
|
422
|
+
return line.replace(rx, replacerFunc);
|
423
423
|
};
|
package/src/log_utils.coffee
CHANGED
package/src/log_utils.js
CHANGED