js-type-helper

0.0.2 • Public • Published

Build Status Coverage Status

TypeJS

TypeJS is lightweight library its give to developer additional functionality for a manipulation (check, validate and using) JavaScript data types. Library support both (AMD, CommonJS)

Docs

Version

npm version GitHub version

Install

CDN

<script type="text/javascript" src="https://cdn.rawgit.com/Hamik25/TypeJS/master/dist/bundle.js"></script>

NPM

$ npm install js-type-helper

Yarn

$ yarn add js-type-helper

Code Examples

const str = 'some text';
TypeJS.getType(str) // String
 
const intNum = 5;
TypeJS.getType(intNum) // Int
 
const floatNum = 8.469;
TypeJS.getType(floatNum) // Float
 
const infNum = 8 / 0;
TypeJS.getType(infNum) // Infinity
 
const negInfNum = -2 / 0;
TypeJS.getType(negInfNum) // -Infinity
 
const nanNum = 80 / 'some text';
TypeJS.getType(nanNum) // NaN
 
const obj = {};
TypeJS.getType(obj) // Object
 
const nul = null;
TypeJS.getType(nul) // Null
 
const unDef;
TypeJS.getType(unDef) // Undefined
 
const bool = true;
TypeJS.getType(bool) // Boolean
 
const arr = [0, 1, 2];
TypeJS.getType(str) // Array
 
const foo = function() {};
TypeJS.getType(str) // Function
 
const date = new Date();
TypeJS.getType(str) // Date

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i js-type-helper

Weekly Downloads

28

Version

0.0.2

License

ISC

Unpacked Size

54.6 kB

Total Files

19

Last publish

Collaborators

  • hamik25