public/js-roguelike-skeleton/src/valid-targets.js
function(){
            var _this = this;
            this.targets.sort(function(a, b){

                var aTypeSortPriority = _this.getTypeSortPriority(a.value);
                var bTypeSortPriority = _this.getTypeSortPriority(b.value);

                if(aTypeSortPriority === bTypeSortPriority){
                    return a.range - b.range;
                }
                if(aTypeSortPriority > bTypeSortPriority){
                    return 1;
                }
                if(aTypeSortPriority < bTypeSortPriority){
                    return -1;
                }
            });
        }
function(){
            var _this = this;
            this.targets.sort(function(a, b){

                var aTypeSortPriority = _this.getTypeSortPriority(a.value);
                var bTypeSortPriority = _this.getTypeSortPriority(b.value);

                if(aTypeSortPriority === bTypeSortPriority){
                    return a.range - b.range;
                }
                if(aTypeSortPriority > bTypeSortPriority){
                    return 1;
                }
                if(aTypeSortPriority < bTypeSortPriority){
                    return -1;
                }
            });
        }
function ( ) { var _this = this ; this . targets . sort ( function ( a , b ) { var aTypeSortPriority = _this . getTypeSortPriority ( a . value ) ; var bTypeSortPriority = _this . getTypeSortPriority ( b . value ) ; if ( aTypeSortPriority === bTypeSortPriority ) { return a . range - b . range ; } if ( aTypeSortPriority > bTypeSortPriority ) { return 1 ; } if ( aTypeSortPriority < bTypeSortPriority ) { return - 1 ; } } ) ; }
Sorts `this.targets` by `this.typeSortPriority` then by range.
@method sort
@return {Number}
Sorts this . targets by this . typeSortPriority then by range .