validate-datatypes
v1.0.0
Published
To validate data types
Downloads
1
Maintainers
Readme
Validate Data Types
To validate data types.
Installation
$ npm install validate-datatypes
Usage
var { isArray, isObject, isNumber, isString, isSymbol,
isBigint, isInteger, isBooleans, isFunction, isUndefined,
isStringArray, isPositiveInteger } = require( "validate-datatypes" );
Examples
console.log( isArray(["Banana", 1, "Apple", 2]) );
// returns true
console.log( isObject({ title: "title" }) );
// returns true
console.log( isNumber(5) );
// returns true
console.log( isString("string") );
// returns true
console.log( isSymbol(Symbol()) );
// returns true
console.log( isBigint(42n) );
// returns true
console.log( isInteger(5) );
// returns true
console.log( isBooleans(true) );
// returns true
console.log( isFunction(function isFunction() {}) );
// returns true
console.log( isUndefined(undefined) );
// returns true
console.log( isStringArray(["Banana", "Orange", "Apple"]) );
// returns true
console.log( isPositiveInteger(-1) );
// returns false
console.log( isPositiveInteger(1) );
// returns true
License
Copyright
Copyright © 2021. S.Gupta