properties
properties copied to clipboard
Parametric properties file
I wonder if it's possible to have a parametric property into a file. Let me explain. Suppose into a file I have something like:
[main]
str1 = "stevekx says " + $param1 + "!"
It would be nice, if I could get the str1 value, passing the value of $ param1. Something like:
var a = properties.get('main.str1', 'hello');
console.log(a) --> stevekx says hello!
Have you considered using the built-in formatting in the util
module? https://nodejs.org/api/util.html#util_util_format_format
[main]
str1 = "stevekx says %s!"
var format = require('util').format;
console.log(format(properties.get('main.str1'), 'hello'));
Oh I did not consider it. Nice to know.
For the moment I was using strformat
https://github.com/fhellwig/strformat
So great to find this solution. Thx guys