From b8a9d97a99045d263cd28d2e596b314453ba6a7d Mon Sep 17 00:00:00 2001 From: thosakwe Date: Mon, 26 Dec 2016 08:11:14 -0500 Subject: [PATCH] enforceParsed --- lib/src/validator.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/src/validator.dart b/lib/src/validator.dart index 54a35e56..ba2d2530 100644 --- a/lib/src/validator.dart +++ b/lib/src/validator.dart @@ -179,6 +179,12 @@ class Validator extends Matcher { return result.data; } + /// Validates, and filters input data after running [autoParse], and throws an error if it is invalid. + /// + /// Otherwise, the filtered data is returned. + Map enforceParsed(Map inputData, List fields) => + enforce(autoParse(inputData, fields)); + /// Creates a copy with additional validation rules. Validator extend(Map schema, {Map defaultValues: const {},