Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why mention anything like IEnumerable or Enumerator? #15

Closed
mwpowellhtx opened this issue Mar 27, 2016 · 1 comment
Closed

Why mention anything like IEnumerable or Enumerator? #15

mwpowellhtx opened this issue Mar 27, 2016 · 1 comment

Comments

@mwpowellhtx
Copy link

Hello,

Just curious, this is an interesting JavaScript extension. But I wonder, why have anything to do with IEnumerable or Enumerator? Why not embrace the goodness of the JavaScript Array, but with LINQ feel to it?

For instance,

if (Array.prototype.any === undefined) {
    Array.prototype.any = function (match) {
        match = match || function (x) { return true; }
        for (let x in this) {
            if (match(x)) { return true; }
        }
        return false;
    }
}

Or, similarly for first:

if (Array.prototype.first === undefined) {
    Array.prototype.first = function (match) {
        match = match || function (x) { return true; }
        for (let x in this) {
            if (match(x)) { return x; }
        }
        return null;
    }
}

Of course, being careful to mesh nicely with the JavaScript API.

@mihaifm
Copy link
Owner

mihaifm commented Apr 1, 2016

I'm not really sure..I think it just tries to mimic the C# code for which it was originally intended.

@mihaifm mihaifm closed this as completed Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants