Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

LINQ

node v6.17.1
version: 3.0.8
endpointsharetweet
Using Library Module has to be loaded by calling require or using import keyword: import {asEnumerable, Range} from "linq-es2015"; Module exports following functions:
var Enumerable = require("linq-es2015");
Range(...) This function generates a sequence of numbers within a specified range. Syntax Range(start, count)
var range = Enumerable.Range(0, 4).ToArray()
Repeat(...) Generates a sequence that contains one repeated value. Syntax Repeat(element, count)
var repeat = Enumerable.Repeat("xx", 5).ToArray()
... and finally the magic of LINQ: default from(...) From(...) asEnumerable(...) All these methods are doing exactly the same thing. In fact they are aliaces of the same method. They convert any iterable sequence (one that implements [Symbol.iterator]) into Enumerable object. Example:
var str = "012345"; var arr = Enumerable.asEnumerable(str).ToArray()
var oddarr = Enumerable.from(Enumerable.Range(1, 15)) .Where(o => o % 2 == 1) .ToArray()
To play with the library add code in the box below. To execute press Shift-Enter:
Loading…

no comments

    sign in to comment