src/core/sanitizor.js
function sanitizeField (sanitizations, value, rules) {
  let result = value

  rules.forEach((rule) => {
    const ruleFn = snakeToCamelCase(rule.name)
    if (typeof (sanitizations[ruleFn]) !== 'function') {
      throw new Error(`${ruleFn} is not a sanitization method`)
    }
    result = sanitizations[ruleFn](result, rule.args)
  })

  return result
}
function sanitizeField (sanitizations, value, rules) {
  let result = value

  rules.forEach((rule) => {
    const ruleFn = snakeToCamelCase(rule.name)
    if (typeof (sanitizations[ruleFn]) !== 'function') {
      throw new Error(`${ruleFn} is not a sanitization method`)
    }
    result = sanitizations[ruleFn](result, rule.args)
  })

  return result
}
function sanitizeField ( sanitizations , value , rules ) { let result = value rules . forEach ( ( rule ) => { const ruleFn = snakeToCamelCase ( rule . name ) if ( typeof ( sanitizations [ ruleFn ] ) !== 'function' ) { throw new Error ( ` ${ ruleFn } ` ) } result = sanitizations [ ruleFn ] ( result , rule . args ) } ) return result }
Runs a bunch of sanitization rules on a given value

@method sanitizeField

@param  {Object} sanitizations
@param  {Mixed}  value
@param  {Array}  rules

@return {Mixed}

@throws {Exception} If sanitization rule doesnt exists
Runs a bunch of sanitization rules on a given value