benchmarks/scenarios/ember.js
function () {
      var sortKeys = arguments;

      return this.toArray().sort(function (a, b) {
        for (var i = 0; i < sortKeys.length; i++) {
          var key = sortKeys[i];
          var propA = _emberMetalProperty_get.get(a, key);
          var propB = _emberMetalProperty_get.get(b, key);
          // return 1 or -1 else continue to the next sortKey
          var compareValue = _emberRuntimeCompare.default(propA, propB);

          if (compareValue) {
            return compareValue;
          }
        }
        return 0;
      });
    }
function () {
      var sortKeys = arguments;

      return this.toArray().sort(function (a, b) {
        for (var i = 0; i < sortKeys.length; i++) {
          var key = sortKeys[i];
          var propA = _emberMetalProperty_get.get(a, key);
          var propB = _emberMetalProperty_get.get(b, key);
          // return 1 or -1 else continue to the next sortKey
          var compareValue = _emberRuntimeCompare.default(propA, propB);

          if (compareValue) {
            return compareValue;
          }
        }
        return 0;
      });
    }
function ( ) { var sortKeys = arguments ; return this . toArray ( ) . sort ( function ( a , b ) { for ( var i = 0 ; i < sortKeys . length ; i ++ ) { var key = sortKeys [ i ] ; var propA = _emberMetalProperty_get . get ( a , key ) ; var propB = _emberMetalProperty_get . get ( b , key ) ; // return 1 or -1 else continue to the next sortKey var compareValue = _emberRuntimeCompare . default ( propA , propB ) ; if ( compareValue ) { return compareValue ; } } return 0 ; } ) ; }
Converts the enumerable into an array and sorts by the keys
specified in the argument.
You may provide multiple arguments to sort by multiple properties.
@method sortBy
@param {String} property name(s) to sort on
@return {Array} The sorted array.
@since 1.2.0
@public
Converts the enumerable into an array and sorts by the keys specified in the argument . You may provide multiple arguments to sort by multiple properties .