NetJS

JavaScript implementation of .NET's Linq to Objects

Website:https://github.com/alxkimball/NETJS

NetJS JavaScript Library

JavaScript implementation of .NET's Linq to Objects

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="underscore.js"></script>
<script src="netjs.full.min.js"></script>
<script>
jQuery(function($) {
  var list2 = new netjs.collections.ext.ArrayList([{a:"bob", b:["bob jr", "joe bob"]}, {a:"sally", b:["sally jr", "sally joe"]}, {a:"frank", b:["frank jr"]}]);
		var project = function(x) {
			return x.b;
		};
		var flatten = function (x, y){
			return y;
		}
		var selectMany = list2.selectMany(project, flatten).toArray();
		//and much much more, SEE tests for by function examples.
});
</script>

Documentation

The library closely mirrors Microsoft's .Net framework library (http://msdn.microsoft.com/en-us/library/system.collections.generic(v=vs.110).aspx).

Examples

See tests for full functionality and usage examples.

Release History

See CHANGELOG

Road Map

v0.1 - Remove dependencies on Underscore and jQuery.

v0.2 - Refactor to AMD for RequiresJS or NodeJS.

v0.8 - ECMA Script 6 support version to use built in generators and yield.

License

Copyright (c) 2012-2014 Alex Kimball Licensed under the MIT, GPL licenses.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Important notes

Please don't edit files in the dist subdirectory as they are generated via grunt. You'll find source code in the src subdirectory!

While grunt can run the included unit tests via PhantomJS, this shouldn't be considered a substitute for the real thing. Please be sure to test the test/*.html unit test file(s) in actual browsers.

Installing grunt

This assumes you have node.js and npm installed already.

  1. See http://gruntjs.com/getting-started

Installing PhantomJS

In order for the qunit task to work properly, PhantomJS must be installed and in the system PATH (if you can run "phantomjs" at the command line, this task should work).

Unfortunately, PhantomJS cannot be installed automatically via npm or grunt, so you need to install it yourself. There are a number of ways to install PhantomJS.

Note that the phantomjs executable needs to be in the system PATH for grunt to see it.