-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I think that we should define this and what are we going to use.
I have seen that on some project that util module is being used for string formatting, which is exact equivalent of PHPs sprintf function.
console.log(
util.format("some text %s, and some number %d",
stringVar,
numberVar
)
);While it has its benefits, like never used %j format, this was written while there were no native string interpolations in nodeJS. Something more natural for the JS world are native string interpolations being used in following format.
console.log(`some text ${stringVar}, and some number ${numberVar}`);I get that we are used to sprintf format from PHP, but I would go propose that we go with something that is native and ditch util.format.
While we pull one less dependency that way, it really looks a lot prettier and less bloated.
I am ok with using this module in cases that require translation and we are binding specific values that just need templating or something else, but for pure logging it just looks unreadable.
What do you guys think?