minLength+maxLength matchers
This commit is contained in:
parent
447aeb833e
commit
53c9de3d5e
3 changed files with 25 additions and 1 deletions
|
@ -49,3 +49,13 @@ final Matcher isUrl = predicate(
|
|||
/// Use [isUrl] instead.
|
||||
@deprecated
|
||||
final Matcher isurl = isUrl;
|
||||
|
||||
/// Enforces a minimum length on a string.
|
||||
Matcher minLength(int length) => predicate(
|
||||
(value) => value is String && value.length >= length,
|
||||
'a string at least $length character(s) long');
|
||||
|
||||
/// Limits the maximum length of a string.
|
||||
Matcher maxLength(int length) => predicate(
|
||||
(value) => value is String && value.length >= length,
|
||||
'a string no longer than $length character(s) long');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: angel_validate
|
||||
description: Cross-platform validation library based on `matcher`.
|
||||
version: 1.0.2+4
|
||||
version: 1.0.3
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/validate
|
||||
environment:
|
||||
|
|
14
validate.iml
Normal file
14
validate.iml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.pub" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Dart SDK" level="project" />
|
||||
<orderEntry type="library" name="Dart Packages" level="project" />
|
||||
</component>
|
||||
</module>
|
Loading…
Reference in a new issue