lib/sortedArray.js
function reverse() {
    /* jshint validthis:true */
    var _ = this._sortedArray,
        reversed = _.reversed;

    if (reversed) {
        this.comparator = this.comparator.original;
    } else {
        this.comparator = getInversionOf(this.comparator);
    }
    _.reversed = !reversed;

    _.reverse.call(this);
}
function reverse() {
    /* jshint validthis:true */
    var _ = this._sortedArray,
        reversed = _.reversed;

    if (reversed) {
        this.comparator = this.comparator.original;
    } else {
        this.comparator = getInversionOf(this.comparator);
    }
    _.reversed = !reversed;

    _.reverse.call(this);
}
function reverse ( ) { /* jshint validthis:true */ var _ = this . _sortedArray , reversed = _ . reversed ; if ( reversed ) { this . comparator = this . comparator . original ; } else { this . comparator = getInversionOf ( this . comparator ) ; } _ . reversed = ! reversed ; _ . reverse . call ( this ) ; }
Works like Array.prototype.reverse.

Please note that this function wraps the current arr.comparator in order to invert the result. Reverting it back
removes the wrapper.

Same signature as Array.prototype.reverse
@see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
Works like Array . prototype . reverse .