Skip to content
hugoware edited this page Sep 14, 2010 · 5 revisions

This is public beta code for jLinq – This project is not complete and is likely to have missing features.

jLinq is a query language for Javascript that allows you to query, sort and select arrays of objects in Javascript. This project was inspired by the Microsoft LINQ framework, but does not require any .NET technologies to be used.

Some commands have changed names (startsWith changed to starts), some have not yet (or may not) be implemented in the core library (selectMany, intersect, etc…).

However, the basics of using jLinq is the same…

var results = jlinq.from(data.users)
    .starts("first", "h")
    .or("b") //no need to repeat field name
    .or("last", "j") //no need to repeat command name
    .greater("age", 40)
    .sort("first", "-age") //- denotes descending
    .select();

This returns a set of matching records sorted in the order requested.

You can refer to the code for a command list or call jlinq.getCommands().

Clone this wiki locally