Skip to content

Instantly share code, notes, and snippets.

@tridungle
Forked from HigoRibeiro/hooks.js
Created December 22, 2020 10:51
Show Gist options
  • Save tridungle/d80ee7d5e6d49af8f3692a0e4a87318d to your computer and use it in GitHub Desktop.
Save tridungle/d80ee7d5e6d49af8f3692a0e4a87318d to your computer and use it in GitHub Desktop.
Adonis sanitization
const { hooks } = require('@adonisjs/ignitor');
hooks.after.providersBooted(() => {
const Validator = use('Validator');
function normalizeCpf(cpf) {
return cpf
}
Validator.sanitizor.cpf = (val) => {
return normalizeCpf(val);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment