function prepareQueryArgs(filterFields = {}) {
  const filters = {};
  Object.keys(filterFields).forEach(key => {
    const value = filterFields[key];

    if (_.isPlainObject(value)) {
      filters[key === `elemMatch` ? `$elemMatch` : key] = prepareQueryArgs(value);
    } else {
      switch (key) {
        case `regex`:
          if (typeof value !== `string`) {
            throw new Error(`The $regex comparator is expecting the regex as a string, not an actual regex or anything else`);
          }

          filters[`$regex`] = (0, _prepareRegex.prepareRegex)(value);
          break;

        case `glob`:
          filters[`$regex`] = (0, _micromatch.makeRe)(value);
          break;

        default:
          filters[`$${key}`] = value;
      }
    }
  });
  return filters;
} // Converts a nested mongo args object into a dotted notation. acc
/**
 * Transforms filters coming from input GraphQL query to mongodb-compatible format
 * (by prefixing comparators with "$").
 *
 * Example:
 *   { foo: { eq: 5 } } -> { foo: { $eq: 5 }}
 */
Transforms filters coming from input GraphQL query to mongodb-compatible format
(by prefixing comparators with "$").


Transforms filters coming from input GraphQL query to mongodb - compatible format ( by prefixing comparators with " $ " ) .
function prepareQueryArgs(filterFields = {}) {
  const filters = {};
  Object.keys(filterFields).forEach(key => {
    const value = filterFields[key];
    if (_.isPlainObject(value)) {
      filters[key === `elemMatch` ? `$elemMatch` : key] = prepareQueryArgs(value);
    } else {
      switch (key) {
        case `regex`:
          if (typeof value !== `string`) {
            throw new Error(`The $regex comparator is expecting the regex as a string, not an actual regex or anything else`);
          }
          filters[`$regex`] = (0, _prepareRegex.prepareRegex)(value);
          break;
        case `glob`:
          filters[`$regex`] = (0, _micromatch.makeRe)(value);
          break;
        default:
          filters[`$${key}`] = value;
      }
    }
  });
  return filters;
} 
function prepareQueryArgs ( filterFields = { } ) { const filters = { } ; Object . keys ( filterFields ) . forEach ( key => { const value = filterFields [ key ] ; if ( _ . isPlainObject ( value ) ) { filters [ key === ` ` ? ` ` : key ] = prepareQueryArgs ( value ) ; } else { switch ( key ) { case ` ` : if ( typeof value !== ` ` ) { throw new Error ( ` ` ) ; } filters [ ` ` ] = ( 0 , _prepareRegex . prepareRegex ) ( value ) ; break ; case ` ` : filters [ ` ` ] = ( 0 , _micromatch . makeRe ) ( value ) ; break ; default : filters [ ` ${ key } ` ] = value ; } } } ) ; return filters ; }
Transforms filters coming from input GraphQL query to mongodb-compatible format
 (by prefixing comparators with "$").
Transforms filters coming from input GraphQL query to mongodb - compatible format ( by prefixing comparators with " $ " ) .
// Converts a nested mongo args object into a dotted notation. acc