Skip to content
Eugene Sadovoi edited this page Jul 7, 2016 · 14 revisions

This library is a continuous effort to implement LINQ using latest features of TypeScript and JavaScript languages (For ES5 compatible library look at linq-es5 branch). The library is implemented in TypeScript and transpiled into JavaScript. It is distributed as a native node module. Browserified and minified standalone UMD modules are located in ./dist directory and could be used directly in compatible browsers. This library uses latest ECMAScript 2015 language specification and utilizes Iterables ([System.iterator]), JavaScript generators (function* ...), and for of loops. All relevant methods are implemented with deferred execution so no unnecessary iterations are performed. The code is backwards compatible with linq-es5 and C# implementations.

Implemented methods

Name Description
[Aggregate] (./aggregate) Applies an accumulator function over a sequence.
[All] (./all) Determines whether all elements of a sequence satisfy a condition.
[Any] (./any) Determines whether a sequence contains any elements.
[AsEnumerable] (./asenumerable) Returns the input typed as Iterable.
[Average] (./average) Computes the average of a sequence of Decimal values.
[Cast] (./cast) Casts the elements of an IEnumerable to the specified type.
[Concat] (./concat) Concatenates two sequences.
[Contains] (./contains) Determines whether a sequence contains a specified element by using the default equality comparer.
[Count] (./count) Returns the number of elements in a sequence.
[DefaultIfEmpty] (./defaultifempty) Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty.
[Distinct] (./distinct) Returns distinct elements from a sequence by using the default equality comparer to compare values.
[ElementAt] (./elementat) Returns the element at a specified index in a sequence.
[ElementAtOrDefault] (./elementatordefault) Returns the element at a specified index in a sequence or a default value if the index is out of range.
[Except] (./except) Produces the set difference of two sequences by using the default equality comparer to compare values.
[First] (./first) Returns the first element of a sequence.
[FirstOrDefault] (./firstordefault) Returns the first element of a sequence, or a default value if the sequence contains no elements.
[GroupBy] (./groupby) Groups the elements of a sequence according to a specified key selector function.
[GroupJoin] (./groupjoin) Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys.
[Intersect] (./intersect) Produces the set intersection of two sequences by using the default equality comparer to compare values.
[Join] (./join) Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys.
[Last] (./last) Returns the last element of a sequence.
[LastOrDefault] (./lastordefault) Returns the last element of a sequence, or a default value if the sequence contains no elements.
[Max] (./max) Returns the maximum value in a sequence of Decimal values.
[Min] (./min) Returns the minimum value in a sequence of Decimal values.
[OfType] (./oftype) Filters the elements of an IEnumerable based on a specified type.
[OrderBy] (./orderby) Sorts the elements of a sequence in ascending order according to a key.
[Range] (./range) Generates a sequence of integral numbers within a specified range.
[Repeat] (./repeat) Generates a sequence that contains one repeated value.
[Reverse] (./reverse) Inverts the order of the elements in a sequence.
[Select] (./select) Projects each element of a sequence into a new form.
[SelectMany] (./selectmany) Projects each element of a sequence to an Iterable, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element.
[SequenceEqual] (./sequenceequal) Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type.
[Single] (./single) Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.
[SingleOrDefault] (./singleordefault) Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.
[Skip] (./skip) Bypasses a specified number of elements in a sequence and then returns the remaining elements.
[SkipWhile] (./skipwhile) Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements.
[Sum] (./sum) Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.
[Take] (./take) Returns a specified number of contiguous elements from the start of a sequence.
[TakeWhile] (./takewhile) Returns elements from a sequence as long as a specified condition is true.
[ThenBy] (./thenby) Performs a subsequent ordering of the elements in a sequence in ascending order by using a specified comparer.
[ThenByDescending] (./thenbydescending) Performs a subsequent ordering of the elements in a sequence in descending order, according to a key.
[ToArray] (./toarray) Creates an array from a Iterable.
[ToMap] (./todictionary) Creates a Map<TKey, TValue> from an Iterable according to a specified key selector function, a comparer, and an element selector function.
[Union] (./union) Produces the set union of two sequences by using a specified IEqualityComparer.
[Where] (./where) Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function.
[Zip] (./zip) Applies a specified function to the corresponding elements of two sequences, producing a sequence of the results.
Clone this wiki locally