Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including shittylinq with all npm packages installed. Try it out:

var shittylinq = require("shittylinq")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

shittylinq v0.0.3

ShittyLINQ.js

The shitty version of the C# LINQ-to-objects Enumerable extension methods for JavaScript.

Bless code style: prettier Build Status

What this is

A function which, when called, adds a bunch of methods to Array.prototype mirroring the System.Linq namespace from C#.

What this is not

What's up with the name?

This project is based on the ShittyLINQ .NET package.

Usage

Run the follwing to install the library:

npm install shittylinq

The library only needs to be imported once. The library exports a single function that needs to be called before the methods can be used. Since the methods are bound to the array prototype, the methods will be available in modules other than where the imported function is called.

require('shittylinq')();

[2, 9, 1, 7, 4]
  .Where(x => x % 2 !== 0)
  .Take(2)
  .Aggregate((a, b) => a + b);
// <- 10

Developing

Please read the contribution guide before beginning development.

Once the project is cloned, run

npm install

This will set up Git hooks to run Prettier when a commit is made.

Running Tests

Tests are run using Mocha. Chai is used as the assertion library.

npm test

License?

MIT

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free