index.js
function arraySort(arr, props, opts) {
  if (arr == null) {
    return [];
  }

  if (!Array.isArray(arr)) {
    throw new TypeError('array-sort expects an array.');
  }

  if (arguments.length === 1) {
    return arr.sort();
  }

  var args = flatten([].slice.call(arguments, 1));

  // if the last argument appears to be a plain object,
  // it's not a valid `compare` arg, so it must be options.
  if (typeOf(args[args.length - 1]) === 'object') {
    opts = args.pop();
  }
  return arr.sort(sortBy(args, opts));
}
function arraySort(arr, props, opts) {
  if (arr == null) {
    return [];
  }

  if (!Array.isArray(arr)) {
    throw new TypeError('array-sort expects an array.');
  }

  if (arguments.length === 1) {
    return arr.sort();
  }

  var args = flatten([].slice.call(arguments, 1));

  // if the last argument appears to be a plain object,
  // it's not a valid `compare` arg, so it must be options.
  if (typeOf(args[args.length - 1]) === 'object') {
    opts = args.pop();
  }
  return arr.sort(sortBy(args, opts));
}
function arraySort ( arr , props , opts ) { if ( arr == null ) { return [ ] ; } if ( ! Array . isArray ( arr ) ) { throw new TypeError ( 'array-sort expects an array.' ) ; } if ( arguments . length === 1 ) { return arr . sort ( ) ; } var args = flatten ( [ ] . slice . call ( arguments , 1 ) ) ; // if the last argument appears to be a plain object, // it's not a valid `compare` arg, so it must be options. if ( typeOf ( args [ args . length - 1 ] ) === 'object' ) { opts = args . pop ( ) ; } return arr . sort ( sortBy ( args , opts ) ) ; }
Sort an array of objects by one or more properties.

@param  {Array} `arr` The Array to sort.
@param  {String|Array|Function} `props` One or more object paths or comparison functions.
@param  {Object} `opts` Pass `{ reverse: true }` to reverse the sort order.
@return {Array} Returns a sorted array.
@api public
Sort an array of objects by one or more properties .