martinandert / counterpart

A translation and localization library for Node.js and the browser.
MIT License
242 stars 25 forks source link

Fallback does not work with string '0' #38

Open awjreynolds opened 8 years ago

awjreynolds commented 8 years ago

I've had to put this check in place to handle strings that are 0 and enable fallback to work successfully.

return label === '0' ? counterpart(table.columns.${label}, { fallback: label }) : label;

martinandert commented 8 years ago

Hi @awjreynolds,

I'm afraid I can't reproduce your issue. Adding a test like this

assert.equal('bar', counterpart('foo.0', { fallback: 'bar' }));

does work for me.

Please send me a bit more code, preferably as a failing spec.