Returns a value as comparer.

A comparer has the following structure:

function (x, y) : number;

Examples

// x == y var comparer1 = Enumerable.toComparerSafe(); // from Lambda var comparer2 = Enumerable.toComparerSafe('(x, y) => y - x'); // from function var comparer3 = Enumerable.toComparerSafe(function(x, y) { return y - x; }); // THROWS EXCEPTION Enumerable.toComparerSafe('test');