Skip to content

Commit

Permalink
Range (in progress)
Browse files Browse the repository at this point in the history
  • Loading branch information
coltoncockman committed Jun 17, 2013
1 parent 98e5ebb commit 8d45508
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/functions.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ functions.max = (values, oldResult, newValues) ->
temp = v
return temp

###
@method range
@static
@param {Number[]} [values] Must either provide values or oldResult and newValues
@param {Number} [oldResult] for incremental calculation
@param {Number[]} [newValues] for incremental calculation
@return {Number} The range value or null if no values
###

This comment has been minimized.

Copy link
@lmaccherone

lmaccherone Jun 17, 2013

Owner

Not sure what's going on here but TravisCI tests fail.

functions.range = (values, oldResult, newValues) ->
if oldResult?
return functions.range(newValues.concat([oldResult]))
if values.length == 0
return null
temp = values[0]
for v in values
if v < temp
temp = v
return temp

###
@method values
@static
Expand Down

0 comments on commit 8d45508

Please sign in to comment.