A quick start guide.

Installation

tns plugin add nativescript-enumerable

Import

import Enumerable = require("nativescript-enumerable");

Create enumerable sequences

From arrays

var seq1 = Enumerable.fromArray([1, 2, 3]);

var seq2 = Enumerable.fromArray(new ObservableArray([1, 2, 3]));

From objects

var seq = Enumerable.fromObject({
    a: 1,
    b: 2
});

From strings

var seq = Enumerable.asEnumerable('Marcel Kloubert');

From values

var seq = Enumerable.create(1, 2, 3, 4, 5);

Usage

var seq = Enumerable.create(5979, 23979, null, '23979', 1781, 241279)
                    .where('x => x !== null')  // remove all elements that are (null)
                    .skip(1)  // skip one element (5979)
                    .take(3)  // take next remaining 3 elements (23979, 23979, 1781)
                    .distinct()  // remove duplicates
                    .select('x => "" + x')  // convert to strings
                    .orderBy('x => x');  // order by element ascending

seq.each(function(x, index) {
    console.log("Item[" + index + "] = " + x);
});