Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametric properties file #6

Open
brunano21 opened this issue Sep 1, 2015 · 3 comments
Open

Parametric properties file #6

brunano21 opened this issue Sep 1, 2015 · 3 comments

Comments

@brunano21
Copy link

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!
@steveukx
Copy link
Owner

steveukx commented Sep 2, 2015

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'));

@brunano21
Copy link
Author

Oh I did not consider it. Nice to know.
For the moment I was using strformat https://github.com/fhellwig/strformat

@hhdem
Copy link

hhdem commented Dec 17, 2015

So great to find this solution. Thx guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants