Awesome validator for node or browser.
Install the library with npm install --save awesome-validator
var validator = require('awesome-validator').validator;
validator.notEmpty().stringType().validate('foo'); //=> true
import validator from 'awesome-validator';
validator.notEmpty().stringType().validate('foo'); //=> true
Or, import only a subset of the library:
import StringType from 'awesome-validator/lib/rules/string-type';
new StringType().validate('foo'); //=> true
import { validator } from 'awesome-validator';
validator.notEmpty().stringType().validate('foo'); //=> true
Or, import only a subset of the library:
import { StringType } from 'awesome-validator/lib/rules/string-type';
new StringType().validate('foo'); //=> true
The library can be loaded either as a standalone script, or through an AMD-compatible loader
<script type="text/javascript" src="awesome-validator.min.js"></script>
<script type="text/javascript">
validator.notEmpty().stringType().validate('foo'); //=> true
</script>
- Age
- AllOf
- Alnum
- Alpha
- AlwaysInvalid
- AlwaysValid
- AnyOf
- ArrayInstance
- ArrayType
- ArrayVal
- Ascii
- Attribute
- Base
- Base64
- Between
- BooleanInstance
- BooleanType
- BooleanVal
- Bsn
- Call
- Callable
- Callback
- Charset
- Cnh
- Cnpj
- Cntrl
- Consonant
- Contains
- Coordinate
- Countable
- CountryCode
- Cpf
- CreditCard
- CurrencyCode
- Currency
- DataUri
- DateFormat
- Decimal
- Digit
- Directory
- Domain
- Each
- Empty
- EndsWith
- Equals
- Even
- Executable
- Exists
- Extension
- Factor
- FalseVal
- Fibonacci
- File
- Finite
- FloatType
- FloatVal
- FullWidth
- FunctionInstance
- FunctionName
- FunctionType
- Graph
- HalfWidth
- Hash
- HexRgbColor
- Identical
- Image
- Imei
- In
- Infinite
- InstanceOf
- IntType
- IntVal
- Ip
- Isbn
- Isbn10
- Isbn13
- Isin
- Iso8601
- Isrc
- Issn
- Iterable
- Json
- KeyNested
- KeySet
- KeyValue
- Key
- Label
- LanguageCode
- Latitude
- LeapDate
- LeapYear
- Locale
- Longitude
- Lowercase
- Luhn
- MacAddress
- Max
- Mimetype
- Min
- MobilePhone
- MongoId
- Multibyte
- Multiple
- Negative
- NfeAccessKey
- NoWhitespace
- No
- NoneOf
- Not
- NotEmpty
- NotOptional
- NullType
- NumberInstance
- NumberType
- NumberVal
- ObjectInstance
- ObjectProperty
- ObjectPropertyFunction
- ObjectTypeStrict
- ObjectType
- Odd
- OneOf
- Optional
- PerfectSquare
- Pesel
- Phone
- Pis
- Port
- Positive
- PostalCode
- PrimeNumber
- Prnt
- PropertyKey
- Punct
- Readable
- RegexInstance
- RegexType
- RegexVal
- Regex
- Roman
- Scalar
- Size
- Slug
- Sorted
- Space
- StartsWith
- StringInstance
- StringType
- StringVal
- SubdivisionCode
- SurrogatePair
- SymbolInstance
- SymbolType
- SymbolVal
- SymbolicLink
- Time
- Timezone
- Tld
- TrueVal
- TypeOf
- Unique
- Uppercase
- Url
- Uuid
- VariableWidth
- Version
- VideoUrl
- Vowel
- When
- Writable
- Xdigit
- Yes