The Sandbox Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

JSINQ - a complete implementation of LINQ to Objects in JavaScript

Back to Forum: The Sandbox
  • User profile image
    kaijaeger

    After lurking around Channel9 for quite some time now, I think it's time to step out of the shadows and actually post something. So here goes:

    I wrote a complete implementation of LINQ to Objects in JavaScript (but you already know that because you've read the title).

    What does complete mean? Well, it means two things:
    a) System.Linq.Enumerable is there (except it's called jsinq.Enumerable) and it has all the same methods... all of them (except those related to casting which don't really apply to JavaScript)
    b) There's a query compiler that allows you write queries in LINQ-syntax.
    c) (Did I say two things, I mean three) If you know LINQ (to Objects) and JavaScript, you know JSINQ!

    But don't take my word for it, try it yourself! (Yes, I do watch a lot of infomercials, why do you ask?)

    So you can almost write something like this:

    from customer in $0
    group customer by customer.lastname into g
    select {lastname: g.getKey(), count: g.count()}
    into r
    orderby r.count descending
    select r

    Except you have to put quotes around it (so it's not really Language INtegrated Query, more like Language bolted-onto Query). But it's still really useful and it's free (as in MIT-licensed), so get yours now!

    More importantly though, tell me what you think and please report bugs if you should find some.

    JSINQ on CodePlex
    Try JSINQ online!
    Read about JSINQ on my blog

    Cheers,
    Kai

  • User profile image
    Andre​Baltieri

    Amazing....
    Congratulations for this good job. This will help me a lot.
    And thanks to share it with us!

  • User profile image
    kaijaeger

    AndreBaltieri said:
    Amazing....
    Congratulations for this good job. This will help me a lot.
    And thanks to share it with us!
    Thanks for the feedback and you're most welcome!

  • User profile image
    camalot

    kaijaeger said:
    AndreBaltieri said:
    *snip*
    Thanks for the feedback and you're most welcome!
    I get an error when loading the "playground" in IE7.

    Line: 65
    Character: 8071
    Error: Expected identifer, string or number.

  • User profile image
    kaijaeger

    camalot said:
    kaijaeger said:
    *snip*
    I get an error when loading the "playground" in IE7.

    Line: 65
    Character: 8071
    Error: Expected identifer, string or number.
    Thanks for the info! It's fixed now!

    I did test in IE 8's IE 7 compat mode, but apparently that's not the same as testing it in IE 7 directly.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.