sprintf.js icon indicating copy to clipboard operation
sprintf.js copied to clipboard

%.f fails with unexpected placeholder

Open daurnimator opened this issue 7 years ago • 1 comments

https://github.com/fengari-lua/fengari/issues/147

C language docs says the following about .precision field in sprintf() format:

If the period is specified without an explicit value for precision, 0 is assumed.

$ node
> require("sprintf-js").sprintf("%.f", 2)
Thrown:
SyntaxError: [sprintf] unexpected placeholder
> require("sprintf-js").sprintf("%.0f", 2)
'2'

daurnimator avatar Feb 13 '19 04:02 daurnimator

PR with fix https://github.com/alexei/sprintf.js/pull/188

ashwalk33r avatar Apr 02 '20 21:04 ashwalk33r