function lowerCase() {
	  for (var _len = arguments.length, fields = Array(_len), _key = 0; _key < _len; _key++) {
	    fields[_key] = arguments[_key];
	  }

	  var lowerCaseFields = function lowerCaseFields(data) {
	    var _iteratorNormalCompletion = true;
	    var _didIteratorError = false;
	    var _iteratorError = undefined;

	    try {
	      for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	        var field = _step.value;

	        var value = (0, _utils.getByDot)(data, field);

	        if (value !== undefined) {
	          if (typeof value !== 'string' && value !== null) {
	            throw new errors.BadRequest('Expected string data. (lowercase ' + field + ')');
	          }

	          (0, _utils.setByDot)(data, field, value ? value.toLowerCase() : value);
	        }
	      }
	    } catch (err) {
	      _didIteratorError = true;
	      _iteratorError = err;
	    } finally {
	      try {
	        if (!_iteratorNormalCompletion && _iterator.return) {
	          _iterator.return();
	        }
	      } finally {
	        if (_didIteratorError) {
	          throw _iteratorError;
	        }
	      }
	    }
	  };

	  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. (lowerCase)');
	  }

	  return function (hook) {
	    var items = hook.type === 'before' ? hook.data : hook.result;

	    var update = function update(condition) {
	      if (items && condition) {
	        if (hook.method === 'find' || Array.isArray(items)) {
	          // data.data if the find method is paginated
	          (items.data || items).forEach(lowerCaseFields);
	        } else {
	          lowerCaseFields(items);
	        }
	      }
	      return hook;
	    };

	    var check = callback(hook);

	    return check && typeof check.then === 'function' ? check.then(update) : update(check);
	  };
	}
/**
	 * Lowercase the given fields either in the data submitted (as a before hook for create,
	 * update or patch) or in the result (as an after hook). If the data is an array or
	 * a paginated find result the hook will lowercase the field for every item.
	 *
	 * @param {Array.<string|Function>} fields - Field names to lowercase. 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)
	 * }));
	 *
	 */
Lowercase the given fields either in the data submitted (as a before hook for create,
update or patch) or in the result (as an after hook). If the data is an array or
a paginated find result the hook will lowercase the field for every item.

@param {Array.} fields - Field names to lowercase. 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.


Lowercase the given fields either in the data submitted ( as a before hook for create update or patch ) or in the result ( as an after hook ) . If the data is an array or a paginated find result the hook will lowercase the field for every item . @param { Array . } fields - Field names to lowercase . 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 lowerCase() {
	  for (var _len = arguments.length, fields = Array(_len), _key = 0; _key < _len; _key++) {
	    fields[_key] = arguments[_key];
	  }
	  var lowerCaseFields = function lowerCaseFields(data) {
	    var _iteratorNormalCompletion = true;
	    var _didIteratorError = false;
	    var _iteratorError = undefined;
	    try {
	      for (var _iterator = fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
	        var field = _step.value;
	        var value = (0, _utils.getByDot)(data, field);
	        if (value !== undefined) {
	          if (typeof value !== 'string' && value !== null) {
	            throw new errors.BadRequest('Expected string data. (lowercase ' + field + ')');
	          }
	          (0, _utils.setByDot)(data, field, value ? value.toLowerCase() : value);
	        }
	      }
	    } catch (err) {
	      _didIteratorError = true;
	      _iteratorError = err;
	    } finally {
	      try {
	        if (!_iteratorNormalCompletion && _iterator.return) {
	          _iterator.return();
	        }
	      } finally {
	        if (_didIteratorError) {
	          throw _iteratorError;
	        }
	      }
	    }
	  };
	  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. (lowerCase)');
	  }
	  return function (hook) {
	    var items = hook.type === 'before' ? hook.data : hook.result;
	    var update = function update(condition) {
	      if (items && condition) {
	        if (hook.method === 'find' || Array.isArray(items)) {
	          (items.data || items).forEach(lowerCaseFields);
	        } else {
	          lowerCaseFields(items);
	        }
	      }
	      return hook;
	    };
	    var check = callback(hook);
	    return check && typeof check.then === 'function' ? check.then(update) : update(check);
	  };
	}
function lowerCase ( ) { for ( var _len = arguments . length , fields = Array ( _len ) , _key = 0 ; _key < _len ; _key ++ ) { fields [ _key ] = arguments [ _key ] ; } var lowerCaseFields = function lowerCaseFields ( data ) { var _iteratorNormalCompletion = true ; var _didIteratorError = false ; var _iteratorError = undefined ; try { for ( var _iterator = fields [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) { var field = _step . value ; var value = ( 0 , _utils . getByDot ) ( data , field ) ; if ( value !== undefined ) { if ( typeof value !== 'string' && value !== null ) { throw new errors . BadRequest ( 'Expected string data. (lowercase ' + field + ')' ) ; } ( 0 , _utils . setByDot ) ( data , field , value ? value . toLowerCase ( ) : value ) ; } } } catch ( err ) { _didIteratorError = true ; _iteratorError = err ; } finally { try { if ( ! _iteratorNormalCompletion && _iterator . return ) { _iterator . return ( ) ; } } finally { if ( _didIteratorError ) { throw _iteratorError ; } } } } ; 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. (lowerCase)' ) ; } return function ( hook ) { var items = hook . type === 'before' ? hook . data : hook . result ; var update = function update ( condition ) { if ( items && condition ) { if ( hook . method === 'find' || Array . isArray ( items ) ) { ( items . data || items ) . forEach ( lowerCaseFields ) ; } else { lowerCaseFields ( items ) ; } } return hook ; } ; var check = callback ( hook ) ; return check && typeof check . then === 'function' ? check . then ( update ) : update ( check ) ; } ; }
Lowercase the given fields either in the data submitted (as a before hook for create,
 update or patch) or in the result (as an after hook).
Lowercase the given fields either in the data submitted ( as a before hook for create update or patch ) or in the result ( as an after hook ) .
// data.data if the find method is paginated