client/src/models/member.js
function (modes) {
        var that = this;

        return modes.sort(function (a, b) {
            var a_idx, b_idx, i;
            var user_prefixes = that.get('user_prefixes');

            for (i = 0; i < user_prefixes.length; i++) {
                if (user_prefixes[i].mode === a) {
                    a_idx = i;
                }
            }

            for (i = 0; i < user_prefixes.length; i++) {
                if (user_prefixes[i].mode === b) {
                    b_idx = i;
                }
            }

            if (a_idx < b_idx) {
                return -1;
            } else if (a_idx > b_idx) {
                return 1;
            } else {
                return 0;
            }
        });
    }
function (modes) {
        var that = this;

        return modes.sort(function (a, b) {
            var a_idx, b_idx, i;
            var user_prefixes = that.get('user_prefixes');

            for (i = 0; i < user_prefixes.length; i++) {
                if (user_prefixes[i].mode === a) {
                    a_idx = i;
                }
            }

            for (i = 0; i < user_prefixes.length; i++) {
                if (user_prefixes[i].mode === b) {
                    b_idx = i;
                }
            }

            if (a_idx < b_idx) {
                return -1;
            } else if (a_idx > b_idx) {
                return 1;
            } else {
                return 0;
            }
        });
    }
function ( modes ) { var that = this ; return modes . sort ( function ( a , b ) { var a_idx , b_idx , i ; var user_prefixes = that . get ( 'user_prefixes' ) ; for ( i = 0 ; i < user_prefixes . length ; i ++ ) { if ( user_prefixes [ i ] . mode === a ) { a_idx = i ; } } for ( i = 0 ; i < user_prefixes . length ; i ++ ) { if ( user_prefixes [ i ] . mode === b ) { b_idx = i ; } } if ( a_idx < b_idx ) { return - 1 ; } else if ( a_idx > b_idx ) { return 1 ; } else { return 0 ; } } ) ; }
Sort modes in order of importance
Sort modes in order of importance