Due to a comment from https://github.com/whatwg/console/issues/148#issuecomment-411821759 , does %d specifier have better use parseInt? On Node.js, Number constructor is used for %d. So console.log('%d', false) prints 0 on Node.js but it prints 'NaN` on Google Chrome.
Is it okay if the specification is different from whatwg?
Code: https://github.com/nodejs/node/blob/master/lib/util.js#L294
whatwg spec: https://console.spec.whatwg.org/#formatting-specifiers
Also, in node, by using Number, decimal places differ from Google Chrome too.
Google Chrome:
console.log('%i', 15.1) // outputs 15
console.log('%d', 15.1) // outputs 15
Node.js:
console.log('%i', 15.1) // outputs 15
console.log('%d', 15.1) // outputs 15.1
It is a contradictory behavior imo.
/ping @silverwind
I'd rather keep the minor difference (which the Node.js ecosystem is probably used to) rather than loose functionality.
I think we should take the breaking change and be spec-conformant. Formatting specifiers should be a rarely used feature and I guess most people would use template strings nowadays to interpolate data in strings. Any opinions from @nodejs/tsc?
as long as our console claims to be the whatwg console we should make sure it follows spec. +1 from me
Hi 馃憢 Thank you for your commens.
I have been waiting for some days. However, there seems to be no opinion in half a month.
I want to fix this issue. Can I implement this and create Pull Request?
Please add 馃憤 if you agree.
PR is blocked and discussion seems to have run its course. Choices at this point are to close (and optionally pursue a spec change) or escalate to TSC. Thoughts? /ping @shisama
@Trott Sorry for my late reply. I closed the PR. Also, I close this. Thank you.
Most helpful comment
Hi 馃憢 Thank you for your commens.
I have been waiting for some days. However, there seems to be no opinion in half a month.
I want to fix this issue. Can I implement this and create Pull Request?
Please add 馃憤 if you agree.