except()

The except linq operator returns a new linq object that contains all of the elements in the originating collection that are not also in the "second" collection. The "second" collection can be anything that the linq.from() method will accept (e.g., an array, a linq object, etc.).

The except operator can also take a comparer function that determines whether two elements are equal.
var arr1 = [1, 2, 3, 4, 5];
var arr2 = [3, 4, 5, 6, 7];
var arr3 = ['one', 'two', 'three', 'four'];
var arr4 = ['THREE', 'FOUR', 'FIVE', 'SIX'];

// col1 = [1, 2]
var col1 = $linq(arr1).except(arr2).toArray();

// col2 = ['one', 'two']
var col2 = $linq(arr3)
    .except(arr4, "(x, y) => x.toLowerCase() == y.toLowerCase()")
    .toArray();

Last edited Dec 18, 2013 at 7:26 PM by battousai999, version 6