rxaviers / cldrjs

Simple CLDR traverser
MIT License
155 stars 30 forks source link

Empty message content throws E_MISSING_MESSAGE #57

Closed mateubo closed 7 years ago

mateubo commented 7 years ago

Hi, cldrjs get method throws E_MISSING_MESSAGE error when message content is an empty string. { "someProp": "" }. I'm aware that an empty string is a "falsy" value, but still, it is a valid message content and it should be returned.

rxaviers commented 7 years ago

That might be a globalize thing since cldrjs doesn't throw that error.

rxaviers commented 7 years ago

Please, could you file an issue there?

mateubo commented 7 years ago

Ah, sorry, the error is indeed thrown by globalize, but the problem is in cldrjs, specifically src/item/lookup.js and quite general if statements there that treat undefined, null, "" in the exactly the same way.

rxaviers commented 7 years ago

Oh, ok. Reopening then... It indeed should return undefined if the path doesn't exist, but the actual value otherwise. Feel free you like to submit a PR and thanks!

mateubo commented 7 years ago

Hi, I submitted a PR for this issue, would you consider accepting it and deploying a new release?

rxaviers commented 7 years ago

Sorry for the delay, just reviewed it.

mateubo commented 7 years ago

I'm sorry for pushing this - I know we are in the middle of the holiday season, please review an updated PR whenever you have the time. Thanks!