mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Implement Symbol#equals()
This commit is contained in:
parent
9adbc3774a
commit
fb890b2c8a
1 changed files with 12 additions and 0 deletions
|
@ -147,5 +147,17 @@ var Symbol = Base.extend(/** @lends Symbol# */{
|
||||||
*/
|
*/
|
||||||
clone: function() {
|
clone: function() {
|
||||||
return new Symbol(this._definition.clone(false));
|
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;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue