function manuallyFilterAndSort(query, raw) {
  const { filters, sort } = query;
  const filterStruct = parseFilters(filters);
  const sortKeys = parseSort(sort);

  const filterKeys = Object.keys(filterStruct).sort();
  const filtered = raw.filter(entry => {
    for (let i = 0; i < filterKeys.length; i++) {
      const key = filterKeys[i];
      const values = filterStruct[key];
      if (values.indexOf(entry[key]) === -1) return false;
    }
    return true;
  });

  if (sortKeys.length === 0) return filtered;

  return filtered.sort((a, b) => {
    for (let i = 0; i < sortKeys.length; i++) {
      const { key, descending } = sortKeys[i];
      if (a[key] === b[key]) continue; // eslint-disable-line no-continue
      const tmp = a[key] < b[key] ? -1 : 1;
      return descending ? -tmp : tmp;
    }

    // All keys were equal in value
    return 0;
  });
}
/*
 * Server-side limitations mean that queries submitted to
 * mod-harvester-admin cannot include filtering criteria and that the
 * data returned is not sorted according to the `orderBy`
 * parameter. Since the total size of the data-set is small, we do the
 * filtering and sorting by hand here in the display component.
 *
 * DO NOT TRY THIS AT HOME.
 */
Server-side limitations mean that queries submitted to
mod-harvester-admin cannot include filtering criteria and that the
data returned is not sorted according to the `orderBy`
parameter. Since the total size of the data-set is small, we do the
filtering and sorting by hand here in the display component.

DO NOT TRY THIS AT HOME.
Server - side limitations mean that queries submitted to mod - harvester - admin cannot include filtering criteria and that the data returned is not sorted according to the ` orderBy ` parameter . Since the total size of the data - set is small we do the filtering and sorting by hand here in the display component . DO NOT TRY THIS AT HOME .
function manuallyFilterAndSort(query, raw) {
  const { filters, sort } = query;
  const filterStruct = parseFilters(filters);
  const sortKeys = parseSort(sort);
  const filterKeys = Object.keys(filterStruct).sort();
  const filtered = raw.filter(entry => {
    for (let i = 0; i < filterKeys.length; i++) {
      const key = filterKeys[i];
      const values = filterStruct[key];
      if (values.indexOf(entry[key]) === -1) return false;
    }
    return true;
  });
  if (sortKeys.length === 0) return filtered;
  return filtered.sort((a, b) => {
    for (let i = 0; i < sortKeys.length; i++) {
      const { key, descending } = sortKeys[i];
      if (a[key] === b[key]) continue; 
      const tmp = a[key] < b[key] ? -1 : 1;
      return descending ? -tmp : tmp;
    }
    return 0;
  });
}
function manuallyFilterAndSort ( query , raw ) { const { filters , sort } = query ; const filterStruct = parseFilters ( filters ) ; const sortKeys = parseSort ( sort ) ; const filterKeys = Object . keys ( filterStruct ) . sort ( ) ; const filtered = raw . filter ( entry => { for ( let i = 0 ; i < filterKeys . length ; i ++ ) { const key = filterKeys [ i ] ; const values = filterStruct [ key ] ; if ( values . indexOf ( entry [ key ] ) === - 1 ) return false ; } return true ; } ) ; if ( sortKeys . length === 0 ) return filtered ; return filtered . sort ( ( a , b ) => { for ( let i = 0 ; i < sortKeys . length ; i ++ ) { const { key , descending } = sortKeys [ i ] ; if ( a [ key ] === b [ key ] ) continue ; const tmp = a [ key ] < b [ key ] ? - 1 : 1 ; return descending ? - tmp : tmp ; } return 0 ; } ) ; }
Server-side limitations mean that queries submitted to
 mod-harvester-admin cannot include filtering criteria and that the
 data returned is not sorted according to the `orderBy`
 parameter.
Server - side limitations mean that queries submitted to mod - harvester - admin cannot include filtering criteria and that the data returned is not sorted according to the ` orderBy ` parameter .
// eslint-disable-line no-continue // All keys were equal in value