src/privates/_sorter.js
function _sorter (reader, isDescending, comparer) {
    if (typeof reader !== "function" || reader === identity) {
        reader = null;
    }

    if (typeof comparer !== "function") {
        comparer = _comparer;
    }

    return {
        isDescending: isDescending === true,
        compare: function (a, b) {
            if (reader) {
                a = reader(a);
                b = reader(b);
            }

            return comparer(a, b);
        }
    };
}
function _sorter (reader, isDescending, comparer) {
    if (typeof reader !== "function" || reader === identity) {
        reader = null;
    }

    if (typeof comparer !== "function") {
        comparer = _comparer;
    }

    return {
        isDescending: isDescending === true,
        compare: function (a, b) {
            if (reader) {
                a = reader(a);
                b = reader(b);
            }

            return comparer(a, b);
        }
    };
}
function _sorter ( reader , isDescending , comparer ) { if ( typeof reader !== "function" || reader === identity ) { reader = null ; } if ( typeof comparer !== "function" ) { comparer = _comparer ; } return { isDescending : isDescending === true , compare : function ( a , b ) { if ( reader ) { a = reader ( a ) ; b = reader ( b ) ; } return comparer ( a , b ) ; } } ; }
Builds a sorting criterion. If the comparer function is missing, the default
comparer will be used instead.
@private
@param {Function} reader
@param {Boolean} isDescending
@param {Function} [comparer]
@returns {Sorter}
Builds a sorting criterion . If the comparer function is missing the default comparer will be used instead .