dtao / lazy.js

Like Underscore, but lazier

Home Page:http://danieltao.com/lazy.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.max(valueFn) fails with valueFn that returns NaN

benadamstyles opened this issue · comments

Actual behaviour:

Lazy(['abc', '5', 'def']).max(x => parseInt(x, 10)) // => 'abc'
Lazy(['1', '5', 'def']).max(x => parseInt(x, 10)) // => '5'

Expected behaviour:

Lazy(['abc', '5', 'def']).max(x => parseInt(x, 10)) // => '5'
Lazy(['1', '5', 'def']).max(x => parseInt(x, 10)) // => '5'

Actually been thinking about this and it's not really .max()'s responsibility to handle NaN.