select()

The select linq operator returns a new linq object that contains results mapped to different objects by a selector function. The select operator will throw an exception if the selector function is not given or is not a function.
var arr = [1, 2, 3, 4, 5];

// col1 = [2, 4, 6, 8, 10]
var col1 = $linq(arr).select(function (x) { return x * 2; }).toArray();

// col2 = [10, 20, 30, 40]
var col2 = $linq(arr)
    .where("x => x < 5")
    .select("x => x * 10")
    .toArray();

Last edited Sep 7, 2012 at 5:51 AM by battousai999, version 4