lib/mixins/list.js
function (fn) {
      var items = this.items;
      var sorted = lazy.sortObject(this.keyMap, {prop: undefined, get: fn});
      var keys = Object.keys(sorted);
      var len = keys.length, i = -1;
      var arr = new Array(len);

      while (++i < len) {
        var key = keys[i];
        arr[i] = items[sorted[key]];
        sorted[key] = i;
      }

      this.items = arr;
      this.keyMap = sorted;
      return this;
    }
function (fn) {
      var items = this.items;
      var sorted = lazy.sortObject(this.keyMap, {prop: undefined, get: fn});
      var keys = Object.keys(sorted);
      var len = keys.length, i = -1;
      var arr = new Array(len);

      while (++i < len) {
        var key = keys[i];
        arr[i] = items[sorted[key]];
        sorted[key] = i;
      }

      this.items = arr;
      this.keyMap = sorted;
      return this;
    }
function ( fn ) { var items = this . items ; var sorted = lazy . sortObject ( this . keyMap , { prop : undefined , get : fn } ) ; var keys = Object . keys ( sorted ) ; var len = keys . length , i = - 1 ; var arr = new Array ( len ) ; while ( ++ i < len ) { var key = keys [ i ] ; arr [ i ] = items [ sorted [ key ] ] ; sorted [ key ] = i ; } this . items = arr ; this . keyMap = sorted ; return this ; }
Sort list items by their keys.

@param  {Function} `fn` Optional getter function to get items by.
@return {Object} Returns current instance to enable chaining
@api public
Sort list items by their keys .