Guest User

Untitled

a guest
Jan 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. app.use(koaValidator({
  2. errorFormatter: function(param, msg, value) {
  3. var namespace = param.split('.')
  4. , root = namespace.shift()
  5. , formParam = root;
  6.  
  7. while(namespace.length) {
  8. formParam += '[' + namespace.shift() + ']';
  9. }
  10. return {
  11. param : formParam,
  12. msg : msg,
  13. value : value
  14. };
  15. }
  16. }));
  17.  
  18. let errors = await ctx.validationErrors().errorFormatter()
  19.  
  20. errors.errorFormatter()
Add Comment
Please, Sign In to add comment