Skip to content

Commit

Permalink
use empty object
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Aug 4, 2015
1 parent 09218cf commit 714f0b8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/ember-metal/lib/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import isEnabled from 'ember-metal/features';
import { protoMethods as listenerMethods } from 'ember-metal/meta_listeners';
import EmptyObject from 'ember-metal/empty_object';

/**
@module ember-metal
Expand Down Expand Up @@ -84,7 +85,7 @@ function ownMap(name, Meta) {
Meta.prototype._getOrCreateOwnMap = function(key) {
let ret = this[key];
if (!ret) {
ret = this[key] = {};
ret = this[key] = new EmptyObject();
}
return ret;
};
Expand All @@ -111,7 +112,7 @@ function inheritedMap(name, Meta) {
};

Meta.prototype['clear' + capitalized] = function() {
this[key] = {};
this[key] = new EmptyObject();
};
}

Expand All @@ -121,7 +122,7 @@ Meta.prototype._getOrCreateInheritedMap = function(key) {
if (this.parent) {
ret = this[key] = Object.create(this.parent._getOrCreateInheritedMap(key));
} else {
ret = this[key] = {};
ret = this[key] = new EmptyObject();
}
}
return ret;
Expand All @@ -147,7 +148,7 @@ function inheritedMapOfMaps(name, Meta) {
let outerMap = this._getOrCreateInheritedMap(key);
let innerMap = outerMap[subkey];
if (!innerMap) {
innerMap = outerMap[subkey] = {};
innerMap = outerMap[subkey] = new EmptyObject();
} else if (!Object.hasOwnProperty.call(outerMap, subkey)) {
innerMap = outerMap[subkey] = Object.create(innerMap);
}
Expand Down

0 comments on commit 714f0b8

Please sign in to comment.