documentcloud/underscore — pull request #441 by AndreasBriese (2012-01-19 22:13:27+00:00)
Title: some additional features / convenience funcs 

Hi,
i added _.sum() _.mean() _.median() to collections section and nrange() to arrays. tests are adjusted appropriately.
in further detail:
_.sum(obj): returns the sum of the elements objects.
_.mean(obj): returns the mean of the elements in the object.
_.median(obj): returns the median element (middle in sorted). works also with string / char elements (i.e. to split lists of names by alphabet)
_.nrange(n) adds convenience functions to _.range(n):
nrange(-3) -> [0, -1, -2];
nrange(0,3) -> [0, 1, 2];
nrnage(3,0) -> [3, 2, 1];
(might replace _.range(n) to reduce redundance)
do{}while() instead of while(){} speeds up the script slightly on FF4+ and Safari.

test suite and speed test is adjusted and tests passed.

Andreas