4
cygnus
198d

Am I the only one that thinks Linq's .Any() and .All() methods are more appropriately named for the use case they cater to, as opposed to their JS counterparts .some() and .every() ?
.some() doesn't justify the fact that it returns true if *atleast* one item in the collection matches the predicate. Should've been named something like .atleastOne() or something else.
Moreover, there isn't any harm to just use the same method names as in Linq ¯\_(ツ)_/¯

Comments
  • 0
    Linq was and still is a great idea
  • 0
    I dunno about JS.

    But SQL 2003 defines ALL | ANY | SOME.

    https://oreilly.com/library/view/...

    Given that SQL standard is not freely available... Link to an extract from OReilly SQL in a nutshell book -.
  • 0
    @IntrusionCM interesting, so why not both @Hazath ? ANY | SOME are just aliases of the same thing.

    Prototype the Array object in JS with the naming conventions you want from Linq.

    Kinda weird ALL reutrns TRUE for an empty set and ANY | SOME return the opposite in SQL 2003.

    However it makes sense because SQL boils down to relational algebra.
  • 0
    The more substantial difference and more fatal error on JavaScript's part is that it has iterables, it has arrays, arrays are defined to be iterables and it has a lot of collection methods but for arrays and not iterables.
Add Comment