src/parse-mockdb.js
function sortQueryresults(matches, order) {
  const orderArray = order.split(',').map(k => {
    let dir = 'asc';
    let key = k;

    if (k.charAt(0) === '-') {
      key = k.substring(1);
      dir = 'desc';
    }

    return [item => deserializeQueryParam(item[key]), dir];
  });

  const keys = orderArray.map(_.first);
  const orders = orderArray.map(_.last);

  return _.orderBy(matches, keys, orders);
}
function sortQueryresults(matches, order) {
  const orderArray = order.split(',').map(k => {
    let dir = 'asc';
    let key = k;

    if (k.charAt(0) === '-') {
      key = k.substring(1);
      dir = 'desc';
    }

    return [item => deserializeQueryParam(item[key]), dir];
  });

  const keys = orderArray.map(_.first);
  const orders = orderArray.map(_.last);

  return _.orderBy(matches, keys, orders);
}
function sortQueryresults ( matches , order ) { const orderArray = order . split ( ',' ) . map ( k => { let dir = 'asc' ; let key = k ; if ( k . charAt ( 0 ) === '-' ) { key = k . substring ( 1 ) ; dir = 'desc' ; } return [ item => deserializeQueryParam ( item [ key ] ) , dir ] ; } ) ; const keys = orderArray . map ( _ . first ) ; const orders = orderArray . map ( _ . last ) ; return _ . orderBy ( matches , keys , orders ) ; }
Sort query results if necessary
Sort query results if necessary