bvalid
v1.0.2
Published
NodeJs validator
Downloads
149
Maintainers
Readme
BValid
npm module to check the type of data. That data can either be function/class or can either be basic data type
Features
- Validate type of any data in JavaScript
- Support in modern JavaScript also
Support
ES5 | ES6 | --- | --- | ✔|✔|
Installing
$ npm install bvalid
Examples
const bvalid = require("bvalid");
or
import bvalid from 'bvalid/lib/bvalid.es';
bvalid.isString( "Hello" ); //true
bvalid.isArray( [] ) //true
bvalid.isObject( {a:"1",b:"2"} ) //true
bvalid.isNumber( "bval12" ) //false
bvalid.isInt( 123 ) //true
bvalid.isFloat( 1.23 ) //true
bvalid.isBigInt( 1234567890n ) //true
bvalid.isNull( null ) //true
bvalid.isUndefined( undefined ) //true
bvalid.isBoolean( "true" ) //false
bvalid.isBuffer( 1234 ) //false
bvalid.isRegex( /[0-9]/ ) //true
bvalid.isFunction( [1,2,3] ) //false
bvalid.isClass( "bvalid" ) //false
bvalid.isPromise( ifPromise ) //true
bvalid.isDate( 12345 ) //false
bvalid.isError( new Error("Err") ) //true
bvalid.isSymbol( "bvalid" ) //false
bvalid.isBase64( ifBase64String ) //true
bvalid.isUrl("http://www.nepsho.com") //true
bvalid.isEmail("[email protected]") //true
bvalid.isPort("3030") //true
bvalid.isUppercase("BVALID") //true
bvalid.isLowercase("bvalid") //false
bvalid.isAlphabet("bvalid") //true
bvalid.isAlphanumeric("bvalid12345") //true
Browser Usage
<script src="./node_module/bvalid/dist/bvalid.min.js"></script>
<script>
const bv = new bvalid();
/*--Use bvalid--*/
</script>
licence
MIT licence
Author
@BCrazyDreamer