Skip to content

Commit

Permalink
Hash.new should convert null/undefined values to nil when a native ob…
Browse files Browse the repository at this point in the history
…ject is passed
  • Loading branch information
elia committed Nov 7, 2013
1 parent 776e171 commit ee0caf1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opal/core/hash.rb
Expand Up @@ -75,11 +75,12 @@ def initialize(defaults = undefined, &block)
%x{
if (defaults != null) {
if (defaults.constructor == Object) {
var map = self.map, keys = self.keys;
var map = self.map, keys = self.keys, value;
for (var key in defaults) {
keys.push(key);
map[key] = defaults[key];
value = defaults[key];
map[key] = value != null ? value : nil
}
}
else {
Expand Down

0 comments on commit ee0caf1

Please sign in to comment.