Hi there boys and girls!
How do you approach string formatting in javascript? Do you use any library or implement the formating yourselves?
I'm developing a loggin' library which relies quite a bit on formatting so i'm really interested in looking for alternatives and what solutions people have come with.
I've been using this library strif I made for my logging library, and it really does the job.
Latest comments (2)
Why not just use string template literals? developer.mozilla.org/en-US/docs/W...
Yes, It could be accomplished using template literals, although for the use case I needed it for, it was not enough, I needed to process each string segment separately and process it in some way, also needed something where I could easily enable and disable some part of the formatting (which we call transformers within strif)
For example:
But yes, for most cases I think template literals are good enough.