Lightweight and fast validation library for javascript
npm install js-fixerr --save
var fixerr = require('js-fixerr');
- min
- max
- isLength
- isWhiteSpace
- isSpecialChar
- isAlphaNumeric
- isMobile
- isEmail
- isDate
- isTime
- isVowel
- isUrl
- isVideoUrl
- isRoman
- isBoolean
- isIPaddress
- isLeapYear
- isMacAddress
- isEqual
Validate if the input is smaller then the min value
fixerr.min('foobaar', 3) // return true
fixerr.min('fooba12', 3) // return true
fixerr.min(34563, 4) // return true
fixerr.min(345, 4) // return false
fixerr.min('foo', 5) // return false
Validate if the input is greater then the max value
fixerr.max('foobaar', 6) // return true
fixerr.max(12345, 6) // return true
fixerr.max(12345, 3) // return false
fixerr.max('foo', 2) // return false
Validate if the string lie between the given value
fixerr.isLength('foobaar',{min:0, max:7}) // return true
fixerr.isLength(123456, {min:0, max:7}) // return true
fixerr.isLength(123456567878, {min:0, max:7}) // return flase
fixerr.isLength('foobaar', {min:0, max:5}); // return false
Validate if the input has whitespace
fixerr.isWhiteSpace('foobaar') // return false
fixerr.isWhiteSpace('a s') // return true
fixerr.isWhiteSpace('') // return false
fixerr.isWhiteSpace('foo baar'); // return true
Validate if the input has Special character
fixerr.isSpecialChar('foo@$ba%ar') // return true
fixerr.isSpecialChar('f!oo~ar') // return true
fixerr.isSpecialChar(' ') // return true
fixerr.isSpecialChar('foobaar'); // return false
Validate if the input has no Alphanumeric characters
fixerr.isAlphaNumeric('foobaar') // return false
fixerr.isAlphaNumeric('fooba901') // return true
Validate if the input is a 10 digit mobile number
fixerr.isMobile(1234567890) // return true
fixerr.isMobile(745387) // return false
Validate if the input is a email address
fixerr.isEmail('[email protected]') // return true
fixerr.isEmail('jsfixerr@com') // return false
fixerr.isEmail('jsfix err@ gmail com') // return false
Validate if the input is a date
fixerr.date('10/12/2017', { format: 'MM/DD/YYYY' }) // return true
fixerr.date('10-12-2017', { format: 'MM-DD-YYYY' }) // return true
fixerr.date('2017-12-12', { format: 'YYYY-DD-MM' }) // return true
fixerr.date('2017/01/08', { format: 'YYYY/DD/MM' }) // return true
Validate if the input is a vowel
fixerr.isVowel('a') // return true
fixerr.isVowel('aeo') // return true
fixerr.isVowel('aeoiu') // return true
fixerr.isVowel('sdf') // return false
fixerr.isVowel('sdfa') // return false
Validate if the input is a youtube video Url
fixerr.isVideoUrl('https://www.youtube.com/watch?v=LyrqhruLhBA') // return true
fixerr.isVideoUrl('https://www.youtube.com/watch?v=LyrqhruLhB') // return false
Validate if the input is a MAC Address
fixerr.isMacAddress('FF:FF:FF:FF:FF:FF') // return true
fixerr.isMacAddress('asman:asdas') // return false
Validate if the input is a leap year
fixerr.isLeapYear(2020) // return true
fixerr.isLeapYear(2017) // return false
Validate if the input is a Ip address
fixerr.isIPaddress('192.168.0.1') // return true
fixerr.isIPaddress('192.168.0.') // return false
Validate if the input has a vowel
fixerr.isVowel('asskdsdf') // return true
fixerr.isVowel('zxcvbn') // return false
Validate if the input is a boolean value
fixerr.isBoolean(true) // return true
fixerr.isBoolean(false) // return true
fixerr.isBoolean(1) // return false
Validate if the input is Roman
fixerr.isRoman('IV') // return true
fixerr.isRoman('iv') // return true
fixerr.isRoman('ER') // return false
*Comparing two values
fixerr.isEqual('sam','nam'); // return false
fixerr.isEqual('sam','sam'); // return true
- Anuj Singh - Initial work - anujsinghwd
This project is licensed under the MIT License - see the LICENSE.md file for details
Feel free to contribute