src/ng2-table/sorter.service.js
function tableDataSort(key, data, direction) {
    var dataCopy = data.map(function (i) { return Object.assign({}, i); });
    dataCopy.sort(function (a, b) {
        var sortResult;
        var aTmp = a[key];
        var bTmp = b[key];
        if (typeof aTmp === 'number' && typeof bTmp === 'number') {
            sortResult = sort(aTmp, bTmp);
        }
        else {
            sortResult = sort((aTmp + '').toLowerCase(), (bTmp + '').toLowerCase());
        }
        return sortResult * direction;
    });
    return dataCopy;
}
function tableDataSort(key, data, direction) {
    var dataCopy = data.map(function (i) { return Object.assign({}, i); });
    dataCopy.sort(function (a, b) {
        var sortResult;
        var aTmp = a[key];
        var bTmp = b[key];
        if (typeof aTmp === 'number' && typeof bTmp === 'number') {
            sortResult = sort(aTmp, bTmp);
        }
        else {
            sortResult = sort((aTmp + '').toLowerCase(), (bTmp + '').toLowerCase());
        }
        return sortResult * direction;
    });
    return dataCopy;
}
function tableDataSort ( key , data , direction ) { var dataCopy = data . map ( function ( i ) { return Object . assign ( { } , i ) ; } ) ; dataCopy . sort ( function ( a , b ) { var sortResult ; var aTmp = a [ key ] ; var bTmp = b [ key ] ; if ( typeof aTmp === 'number' && typeof bTmp === 'number' ) { sortResult = sort ( aTmp , bTmp ) ; } else { sortResult = sort ( ( aTmp + '' ) . toLowerCase ( ) , ( bTmp + '' ) . toLowerCase ( ) ) ; } return sortResult * direction ; } ) ; return dataCopy ; }
https://github.com/thelgevold/angular-2-samples
https : // github . com / thelgevold / angular - 2 - samples