2.0.1+1
This commit is contained in:
parent
6b125807f5
commit
f2a2ed6900
6 changed files with 31 additions and 30 deletions
|
@ -1,3 +1,6 @@
|
|||
# 2.0.1+1
|
||||
* Fix bug in the implementation of `maxLength`.
|
||||
|
||||
# 2.0.1
|
||||
* Patch for updated body parsing.
|
||||
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
import 'package:angel_validate/angel_validate.dart';
|
||||
|
||||
main() {
|
||||
var bio = new Validator({
|
||||
'age*': [isInt, greaterThanOrEqualTo(0)],
|
||||
'birthYear*': isInt,
|
||||
'countryOfOrigin': isString
|
||||
});
|
||||
var bio = new Validator({
|
||||
'age*': [isInt, greaterThanOrEqualTo(0)],
|
||||
'birthYear*': isInt,
|
||||
'countryOfOrigin': isString
|
||||
});
|
||||
|
||||
var book = new Validator({
|
||||
'title*': isString,
|
||||
'year*': [
|
||||
isNum,
|
||||
(year) {
|
||||
return year <= new DateTime.now().year;
|
||||
}
|
||||
]
|
||||
});
|
||||
var book = new Validator({
|
||||
'title*': isString,
|
||||
'year*': [
|
||||
isNum,
|
||||
(year) {
|
||||
return year <= new DateTime.now().year;
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
var author = new Validator({
|
||||
'bio*': bio,
|
||||
'books*': [
|
||||
isList,
|
||||
everyElement(book)
|
||||
]
|
||||
}, defaultValues: {
|
||||
'books': []
|
||||
});
|
||||
}
|
||||
// ignore: unused_local_variable
|
||||
var author = new Validator({
|
||||
'bio*': bio,
|
||||
'books*': [isList, everyElement(book)]
|
||||
}, defaultValues: {
|
||||
'books': []
|
||||
});
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ Matcher minLength(int length) => predicate(
|
|||
|
||||
/// Limits the maximum length of a string.
|
||||
Matcher maxLength(int length) => predicate(
|
||||
(value) => value is String && value.length >= length,
|
||||
(value) => value is String && value.length <= length,
|
||||
'a string no longer than $length character(s) long');
|
||||
|
||||
/// Asserts that for a key `x`, the context contains an identical item `x_confirmed`.
|
||||
|
|
|
@ -79,7 +79,7 @@ class Validator extends Matcher {
|
|||
requiredFields.add(fieldName);
|
||||
}
|
||||
|
||||
Iterable _iterable =
|
||||
var _iterable =
|
||||
schema[keys] is Iterable ? schema[keys] : [schema[keys]];
|
||||
var iterable = [];
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_validate
|
||||
description: Cross-platform request body validation library based on `matcher`.
|
||||
version: 2.0.1
|
||||
version: 2.0.1+1
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/validate
|
||||
environment:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import 'dart:html';
|
||||
import 'package:angel_validate/angel_validate.dart';
|
||||
|
||||
final UListElement $errors = querySelector('#errors');
|
||||
final FormElement $form = querySelector('#form');
|
||||
final InputElement $blank = querySelector('[name="blank"]');
|
||||
final $errors = querySelector('#errors') as UListElement;
|
||||
final $form = querySelector('#form') as FormElement;
|
||||
final $blank = querySelector('[name="blank"]') as InputElement;
|
||||
|
||||
final Validator formSchema = new Validator({
|
||||
'firstName*': [isString, isNotEmpty],
|
||||
|
|
Loading…
Reference in a new issue