function pluckQuery() {
	  for (var _len3 = arguments.length, fields = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
	    fields[_key3] = arguments[_key3];
	  }

	  var pluckQueries = function pluckQueries(data) {
	    var plucked = {};

	    fields.forEach(function (field) {
	      var value = (0, _utils.getByDot)(data, field); // prevent setByDot creating nested empty objects
	      if (value !== undefined) {
	        (0, _utils.setByDot)(plucked, field, value);
	      }
	    });

	    return plucked;
	  };

	  var callback = function callback() {
	    return true;
	  };
	  if (typeof fields[fields.length - 1] === 'function') {
	    callback = fields.pop();
	    console.error('DEPRECATED Predicate func will be removed next version. (pluckQuery)');
	  }

	  return function (hook) {
	    if (hook.type === 'after') {
	      throw new errors.GeneralError('Provider \'' + hook.params.provider + '\' can not pluck query params on after hook. (pluckQuery)');
	    }
	    var result = hook.params.query;
	    var update = function update(condition) {
	      if (result && condition) {
	        hook.params.query = pluckQueries(result);
	      }
	      return hook;
	    };

	    var check = callback(hook);

	    return check && typeof check.then === 'function' ? check.then(update) : update(check);
	  };
	}
/**
	 * Discard all other fields except for the given fields from the query params.
	 * Can be used as a before hook for any service method.
	 *
	 * @param {Array.<string|Function>} fields - Field names to retain. Dot notation is supported.
	 * @returns {Function} hook function(hook)
	 *
	 * DEPRECATED: The last param may be a function to determine if the current hook should be updated.
	 * Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean.
	 * This boolean determines if the hook is updated.
	 *
	 * hooks.lowerCase('group', hook => hook.data.status === 1);
	 * hooks.lowerCase('group', hook => new Promise(resolve => {
	 *   setTimeout(() => { resolve(true); }, 100)
	 * }));
	 */
Discard all other fields except for the given fields from the query params.
Can be used as a before hook for any service method.

@param {Array.} fields - Field names to retain. Dot notation is supported.

The last param may be a function to determine if the current hook should be updated.
Its signature is func(hook) and it returns either a boolean or a promise resolving to a boolean.
This boolean determines if the hook is updated.


Discard all other fields except for the given fields from the query params . Can be used as a before hook for any service method . @param { Array . } fields - Field names to retain . Dot notation is supported . The last param may be a function to determine if the current hook should be updated . Its signature is func ( hook ) and it returns either a boolean or a promise resolving to a boolean . This boolean determines if the hook is updated .
function pluckQuery() {
	  for (var _len3 = arguments.length, fields = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
	    fields[_key3] = arguments[_key3];
	  }
	  var pluckQueries = function pluckQueries(data) {
	    var plucked = {};
	    fields.forEach(function (field) {
	      var value = (0, _utils.getByDot)(data, field); 
	      if (value !== undefined) {
	        (0, _utils.setByDot)(plucked, field, value);
	      }
	    });
	    return plucked;
	  };
	  var callback = function callback() {
	    return true;
	  };
	  if (typeof fields[fields.length - 1] === 'function') {
	    callback = fields.pop();
	    console.error('DEPRECATED Predicate func will be removed next version. (pluckQuery)');
	  }
	  return function (hook) {
	    if (hook.type === 'after') {
	      throw new errors.GeneralError('Provider \'' + hook.params.provider + '\' can not pluck query params on after hook. (pluckQuery)');
	    }
	    var result = hook.params.query;
	    var update = function update(condition) {
	      if (result && condition) {
	        hook.params.query = pluckQueries(result);
	      }
	      return hook;
	    };
	    var check = callback(hook);
	    return check && typeof check.then === 'function' ? check.then(update) : update(check);
	  };
	}
function pluckQuery ( ) { for ( var _len3 = arguments . length , fields = Array ( _len3 ) , _key3 = 0 ; _key3 < _len3 ; _key3 ++ ) { fields [ _key3 ] = arguments [ _key3 ] ; } var pluckQueries = function pluckQueries ( data ) { var plucked = { } ; fields . forEach ( function ( field ) { var value = ( 0 , _utils . getByDot ) ( data , field ) ; if ( value !== undefined ) { ( 0 , _utils . setByDot ) ( plucked , field , value ) ; } } ) ; return plucked ; } ; var callback = function callback ( ) { return true ; } ; if ( typeof fields [ fields . length - 1 ] === 'function' ) { callback = fields . pop ( ) ; console . error ( 'DEPRECATED Predicate func will be removed next version. (pluckQuery)' ) ; } return function ( hook ) { if ( hook . type === 'after' ) { throw new errors . GeneralError ( 'Provider \'' + hook . params . provider + '\' can not pluck query params on after hook. (pluckQuery)' ) ; } var result = hook . params . query ; var update = function update ( condition ) { if ( result && condition ) { hook . params . query = pluckQueries ( result ) ; } return hook ; } ; var check = callback ( hook ) ; return check && typeof check . then === 'function' ? check . then ( update ) : update ( check ) ; } ; }
Discard all other fields except for the given fields from the query params.
Discard all other fields except for the given fields from the query params .
// prevent setByDot creating nested empty objects