Delete unspecified properties
is it possible to delete properties that wasn't included into validations rules from the validated object ?
didn't get your point. you need to elaborate, what you are trying to achieve?
for example if we have an endpoint that takes id as parameter and we setup the validation for this parameter. when we receive a request with id,name we delete name parameter because it wasn't specified on the validation rules
@bitnbytesio please let me now if you need further explanation, and if it's expected to be added to the library, i can create a PR for this if it's ok
Sorry for they late reply, I was too busy with other stuff. PR always WELCOMED. Please explain your situation on https://jsfiddle.net/ or some other platform of that kind.
Inputs:
{ name: 'Some Name', email: "[email protected]", __v: 24, }
Rules:
{ name: 'required|string', email: 'required|string', }
You want this library to get rid of __v property as it is not declared in validation rules
Expected Output:
{ name: 'Some Name', email: "[email protected]", }
yes that's it
Has this been included?
+1
release under beta v5.0.0-beta.7