Implement Symbol#equals()

This commit is contained in:
Jürg Lehni 2014-12-28 18:03:19 +01:00
parent 9adbc3774a
commit fb890b2c8a

View file

@ -147,5 +147,17 @@ var Symbol = Base.extend(/** @lends Symbol# */{
*/
clone: function() {
return new Symbol(this._definition.clone(false));
},
/**
* Checks whether the symbol's definition is equal to the supplied symbol.
*
* @param {Symbol} symbol
* @return {Boolean} {@true if they are equal}
*/
equals: function(symbol) {
return symbol === this
|| symbol && this.definition.equals(symbol.definition)
|| false;
}
});