validate-datatypes

1.0.0 • Public • Published

Validate Data Types

npm Support Node of LTS dependencies Status

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

MIT license.

Copyright

Copyright © 2021. S.Gupta

Package Sidebar

Install

npm i validate-datatypes

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

7.3 kB

Total Files

5

Last publish

Collaborators

  • samkgpt