Naveen Chawla naveen.chwl at
Mon Oct 2 15:34:07 UTC 2017

I would just use reduce for this. Reason: I think any multi var result
format is a little messy. I find it better to let the dev decide on the
result format, e.g.:

const minMax =
         (accumulator, currentValue)=>{
              return {
                  min: Math.min(currentValue, accumulator.min),
                  max: Math.max(currentValue, accumulator.max)
             min: Infinity,
             max: -Infinity

Good thing is, this can easily be refactored to accept arrays with objects
that contain the values, instead of just an array of numbers, as well as
the ability to calculator other accumulated values (e.g. mean average etc.)
in the same call.

Do let me know if you think I'm missing the point

On Mon, 2 Oct 2017 at 19:16 Boris Zbarsky <bzbarsky at> wrote:

> On 10/2/17 7:10 AM, Xavier Stouder wrote:
> > Don't know what Boris mean when he talks about recreation bits
> Fwiw, it looks like the code at
> does not have the
> array recreation bits (function whatever(...args)) that earlier
> benchmarks for this had.
> -Boris
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list