W3C home > Mailing lists > Public > www-archive@w3.org > February 2011

jsinq bug: .min/.max on single-element list

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sun, 27 Feb 2011 23:41:45 +0100
To: jaeger@xwrs.net
Cc: www-archive@w3.org
Message-ID: <p2klm6l9a99i417oc89a4u7k30q9k2aogk@hive.bjoern.hoehrmann.de>
Hi,

  Thanks for your excellent jsinq library. I have found a bug, if you
run .min or .max on a list with only one element the result selector is
not applied, while in C# `new List<int>() { 1 }.Min(x => x + 1)` you get
`2`, with jsinq `new jsinq.Enumerable([1]).min(function(x){ return x+1
})` you get `1` instead. A solution would be applying .select with the
result selector and then returning the min/max of the result.

regards,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Sunday, 27 February 2011 22:42:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 7 November 2012 14:18:34 GMT