poppinss / indicative

Indicative is a simple yet powerful data validator for Node.js and browsers. It makes it so simple to write async validations on nested set of data.
https://indicative.adonisjs.com/
MIT License
417 stars 52 forks source link

":" symbol bugs #91

Closed devmark closed 7 years ago

devmark commented 7 years ago
indicativeValidate({
            test: '12:22:22',
},
{
           test: 'date_format:HH:MM:SS',
});

expected: args[0] = HH:MM:SS

result: args[0] = HH

should escape ":" in content

thetutlage commented 7 years ago

You can do it as an array

test: ['date_format:HH:MM:SS'],
devmark commented 7 years ago
const _parseValidation = function (validation) {
  return _(validation.split(':'))
  .thru((value) => {
    const args = value[1] ? value[1].split(',') : []
    return {name: value[0], args}
  })
  .value()
}

using array not help for that but help for | only

thetutlage commented 7 years ago

Fixed in https://github.com/poppinss/indicative/commit/26468ac2bbab6b521a764f52ac14edc560d1357e.

Docs will be out soon