orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

Bug: dictionary transform falsy default values to undefined #386

Open macrozone opened 8 years ago

macrozone commented 8 years ago

if you pass a falsy value, eg. 0 to orion as default value, it returns "undefined" if this dictionary is not set:

`orion.dictionary.get("mykey", 0)``

Problem is how it checks for non existing default value:

https://github.com/orionjs/orion/blob/master/packages/dictionary/dictionary.js#L100

!defaultValue is true for 0, so it will change it to undefined

Better check for undefined with typeof defaultValue !=== "undefined" or similar