Closed paragrudani1 closed 1 year ago
Please reference the trim
rule. It uses the mutate
function to mutate the value of a field.
https://github.com/adonisjs/validator/blob/develop/src/Validations/string/trim.ts#L27-L32
Thanks for guiding me @thetutlage ! I have just tried, and it works like a magic.
Let's say I want to slice a string from a validator.
There are lot of use cases where one needs to manipulate value using custom validation rule.
if I can create a custom rule with feature of manipulate values, I do not have to create little utility functions around the app also It's very difficult to manipulate fields manually in a complex object.
Here's something I need after creating custom rule of
trim
: ex:rules.slice(20)