An open API service indexing awesome lists of open source software.

https://github.com/hoehrmann/jsinq

Fork of jsinq
https://github.com/hoehrmann/jsinq

Last synced: 10 months ago
JSON representation

Fork of jsinq

Awesome Lists containing this project

README

          

-------------------------------------------------------------------------------
JSINQ - LINQ to Objects for JavaScript, Version 1.0
http://www.codeplex.com/jsinq

Copyright (c) 2010 Kai Jäger. Some rights reserved.

Use of the JSINQ source code is governed by an MIT-style license that can be
found in the license.txt file.
-------------------------------------------------------------------------------

What is JSINQ?

JSINQ is a complete implementation of LINQ to Objects in JavaScript. LINQ
stands for "Language Integrated Query" and it is a component of Microsoft's
.NET framework. With LINQ, you can write SQL-like queries against in-memory
collections, relational databases, XML documents and many other data sources.
LINQ to Objects, the part of LINQ that JSINQ implements in JavaScript, deals
with querying in-memory data structures such as arrays, lists, etc.

Release Notes for Version 1.0

* jsinq-enumerable.js renamed to jsinq.js as it now also hosts the new types
jsinq.Dictionary and jsinq.List (see next two bullet points)

* New type jsinq.Dictionary, a faithful JavaScript implementation of
System.Collections.Generic.Dictionary. Supports both primitive and complex
keys (complex keys are supported with limited efficiency)

* New type jsinq.List, a faithful JavaScript implementation of
System.Collections.Generic.List.

* New test suite for jsinq.Dictionary

* New test suite for jsinq.List

* jsinq.Enumerable modified to use jsinq.Dictionary instead of specialized hash
type that was used in previous versions.

* New .NET 4.0 query operator "zip" added to jsinq.Enumerable

* New method "each" for jsinq.Enumerable that simplifies enumeration

How to use JSINQ

* Copy the files jsinq.js and jsinq-query.js from the build folder
to a location in your project folder.

* Embed the JavaScript files into your HTML page using the following code


* Use JSINQ like this:

var data = [1, 2, 3];
var query = new jsinq.Query('from d in $0 select d');
query.setValue(0, new jsinq.Enumerable(data));
var result = query.execute();
result.each(function(element) {
document.write(element);
});

* Look at the examples in the samples folder and read the reference at
http://www.codeplex.com/jsinq

* Report bugs and give feedback. Thanks!

Known issues

* The error messages generated by the query compiler are often inaccurate and
the line numbers referred to in the error message are often not where the
actual error is.

* The query compiler will fail to compile expressions that contain the new or
typeof operator without a trailing whitespace, e.g. new(Object) will fail.

* The query parser does not currently understand regular expression literals.
If you wish to use regular expressions in your query, use new RegExp(...)
or define your regular expressions outside the query and pass them in via
placeholders (this is the preferred method).

* The test suite for jsinq.Query is inadequate and only tests a handful of
mostly trivial queries.