src/data/DataProvider.js
function(array, bbox) {
        if (typeof this.options.sort === 'function') {
            this._sortByDistance = this.options.sort;
        } else {
            this._sortByDistance = function(array, bbox) {
                var p = bbox[0];
                array.sort(function(a, b) {
                    var d = (a[1] - p[1]) - (b[1] - p[1]);
                    if (d === 0) {
                        d = (a[0] - p[0]) - (b[0] - p[0]);
                    }
                    return d;
                });
                return array;
            }
        }
        return this._sortByDistance(array, bbox);
    }
function(array, bbox) {
        if (typeof this.options.sort === 'function') {
            this._sortByDistance = this.options.sort;
        } else {
            this._sortByDistance = function(array, bbox) {
                var p = bbox[0];
                array.sort(function(a, b) {
                    var d = (a[1] - p[1]) - (b[1] - p[1]);
                    if (d === 0) {
                        d = (a[0] - p[0]) - (b[0] - p[0]);
                    }
                    return d;
                });
                return array;
            }
        }
        return this._sortByDistance(array, bbox);
    }
function ( array , bbox ) { if ( typeof this . options . sort === 'function' ) { this . _sortByDistance = this . options . sort ; } else { this . _sortByDistance = function ( array , bbox ) { var p = bbox [ 0 ] ; array . sort ( function ( a , b ) { var d = ( a [ 1 ] - p [ 1 ] ) - ( b [ 1 ] - p [ 1 ] ) ; if ( d === 0 ) { d = ( a [ 0 ] - p [ 0 ] ) - ( b [ 0 ] - p [ 0 ] ) ; } return d ; } ) ; return array ; } } return this . _sortByDistance ( array , bbox ) ; }
Sorts the given data array
Sorts the given data array