Point.toEqual will return true if it matches an array

`new Point(1,2)` is equivalent to `[1,2]`.
This commit is contained in:
Corey Johnson
2012-02-01 15:54:28 -08:00
parent dc9a343b9d
commit cc3b5732e7
2 changed files with 15 additions and 1 deletions

View File

@@ -14,7 +14,10 @@ class Point
constructor: (@row, @column) ->
isEqual: (other) ->
@row == other.row && @column == other.column
if other instanceof Array
@row == other[0] and @column == other[1]
else
@row == other.row and @column == other.column
compare: (other) ->
if @row > other.row