formatString not working with falsy values as parameter
Closed this issue · 2 comments
legrak commented
S.formatString("Value should be between {0} and {1}", 0, 10).
var valueForPlaceholder = valuesForPlaceholders[matchedKey];
here valueForPlaceholder is resolved just fine.
if (!valueForPlaceholder) {
valueForPlaceholder = valuesForPlaceholders[0][matchedKey];
}
here (because of 'if (!0)' is true) it goes undefined.
if (isReactComponent(valueForPlaceholder)) {
here it crashes
TryingToImprove commented
I got the same error.
I resolved it with adding .toString
.
strings.formatString(strings.myString, 0.toString())
joshsalverda commented
This was my fault, I have another PR incoming shortly... You'd think this is my first time writing JS 😩