BANGALORE, INDIA: When doing development on .NET framework using Visual Studio 2008, you must have used LINQ (Language INtegrated Query). The language allows standard query operations to be integrated onto the .NET platform, to provide a unified way to query across objects, databases, and XML in a standard way. This enables developers to use query style syntaxes in their codes while referring to objects or datasets.
The whole process makes writing code for fetching values from an object list easier. A developer doesn't have to write iterations to parse through the object list, but rather get the work done in SQL query format. Till recently, the same wasn't possible for Java developers.
Using JSINQ, however, you can write similar SQL queries while programming in JavaScript. This means you now have a query language in JavaScript that you can use against arrays and DOM node lists. As LINQ has reduced the need to write lesser code and provides simplicity in code management, the same would now be possible with JSINQ for JavaScript related development.
Key features
JSINQ is a JavaScript library, that you can use to implement LINQ style querying for JavaScript codes. The acronym, JSINQ stands for JavaScript INtegrated Query, which is a complete implementation of LINQ to objects in JavaScript, which means that JSINQ is implementation of LINQ's System.Linq.Enumerable and also has a complete query-expression compiler that translates SQL-style queries into JavaScript code. JSINQ is a result of a project started by Kai Jager and is available for download from CodePlex.
By using JSINQ you can not only use it against arrays in JavaScript, but can be used for writing complex queries find elements in the HTML DOM tree nodes. It can also be used to create HTML elements dynamically from JSON or XML that have been passed forward via XMLHttpRequest in a more declarative manner, rather than writing long iterative codes. Using JSINQ can be extended to other JavaScript based frameworks like Ajax as well.
You can start using JSINQ by downloading the JSINQ library from the Codeplex site ( link provided in the direct-hit box), and when you extract the contents of the zipped archive file you will find two JavaScript files, namely "jsinq-enumerable.js? and "jsinq-query.js".
The jsinq-enumerable is the module that implements the System.Linq. Enumerable of LINQ from .NET framework in JavaScript, while the other module, jsinq-query is the implementation in JavaScript for System.Linq.Queryable and is the query-expression compiler. These are the two JSINQ files that you need to include in your HTML page to implement LINQ style querying for objects while writing coding in JavaScript.