Add Range.fromObject, which takes a [start, end] array

This commit is contained in:
Nathan Sobo
2012-03-05 16:06:57 -07:00
parent fc7a13ce05
commit 3cc559fd9c

View File

@@ -4,6 +4,13 @@ _ = require 'underscore'
module.exports =
class Range
@fromObject: (object) ->
if _.isArray(object)
new Range(object...)
else
object
constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) ->
pointA = Point.fromObject(pointA)
pointB = Point.fromObject(pointB)