[Feature Request] Add sprintf as a ReplaceVariable
Describe the solution you'd like
sprintf is a familiar tool in a number of programming languages. I recently came into a use case where I wanted to format a number as money. I created a $sprintf ReplaceVariable and used it like so:
$sprintf["$%0.2f", $customVariable[money]]
// => $4.20
After the fact I discovered that $round[$customVariable[money], 2] would probably work as well for this specific use case. However, as a power user, I love generalizable functions, for the next time I have a similar but not identical need!
Additional context
-
The
sprintf-jsnode module is already one of the indirect dependencies of Firebot. This would add it (and@types/sprintf-js) as first class dependencies to packages.json. -
I'm ready to go with a pull request if this gets dev approval. (I'd probably add it to
variables/builtin/miscorvariables/builtin/utility.) If the developers don't want this as part of base Firebot, I can just post it on my GitHub instead.