src/operator/data-builder.js
function getSortFn (dataType, sortType, index) {
    let retFunc;
    switch (dataType) {
    case MeasureSubtype.CONTINUOUS:
    case DimensionSubtype.TEMPORAL:
        if (sortType === 'desc') {
            retFunc = (a, b) => b[index] - a[index];
        } else {
            retFunc = (a, b) => a[index] - b[index];
        }
        break;
    default:
        retFunc = (a, b) => {
            const a1 = `${a[index]}`;
            const b1 = `${b[index]}`;
            if (a1 < b1) {
                return sortType === 'desc' ? 1 : -1;
            }
            if (a1 > b1) {
                return sortType === 'desc' ? -1 : 1;
            }
            return 0;
        };
    }
    return retFunc;
}
function getSortFn (dataType, sortType, index) {
    let retFunc;
    switch (dataType) {
    case MeasureSubtype.CONTINUOUS:
    case DimensionSubtype.TEMPORAL:
        if (sortType === 'desc') {
            retFunc = (a, b) => b[index] - a[index];
        } else {
            retFunc = (a, b) => a[index] - b[index];
        }
        break;
    default:
        retFunc = (a, b) => {
            const a1 = `${a[index]}`;
            const b1 = `${b[index]}`;
            if (a1 < b1) {
                return sortType === 'desc' ? 1 : -1;
            }
            if (a1 > b1) {
                return sortType === 'desc' ? -1 : 1;
            }
            return 0;
        };
    }
    return retFunc;
}
function getSortFn ( dataType , sortType , index ) { let retFunc ; switch ( dataType ) { case MeasureSubtype . CONTINUOUS : case DimensionSubtype . TEMPORAL : if ( sortType === 'desc' ) { retFunc = ( a , b ) => b [ index ] - a [ index ] ; } else { retFunc = ( a , b ) => a [ index ] - b [ index ] ; } break ; default : retFunc = ( a , b ) => { const a1 = ` ${ a [ index ] } ` ; const b1 = ` ${ b [ index ] } ` ; if ( a1 < b1 ) { return sortType === 'desc' ? 1 : - 1 ; } if ( a1 > b1 ) { return sortType === 'desc' ? - 1 : 1 ; } return 0 ; } ; } return retFunc ; }
Generates the sorting functions to sort the data of a DataModel instance
according to the input data type.

@param {string} dataType - The data type e.g. 'measure', 'datetime' etc.
@param {string} sortType - The sorting order i.e. 'asc' or 'desc'.
@param {integer} index - The index of the data which will be sorted.
@return {Function} Returns the the sorting function.
Generates the sorting functions to sort the data of a DataModel instance according to the input data type .