what.js

1.0.1 • Public • Published

what.js

what.js what.js is a simple library to get the type of variables. enganced javascript typeof function.

Build Status npm npm npm

1. Install

npm install what.js

Then import it.

var what = require('what.js');
 
//or
 
import what from 'what.js';

Or import it with <script> tag.

<script type="text/javascript" src="what.min.js"></script>

2. Detail Usage

what({}); // 'object'
what({abc: 123}); // 'object'
 
what([]); // 'array'
what([123, 'abc']); // 'array'
 
what(function() {}); // 'function'
what(setTimeout); // 'function'
 
what(/^what\.js$/); // 'regexp'
 
what(new Date()); // 'date'
 
what(null); // 'null'
what(undefined); // 'undefined'
 
what('abc'); // 'string'
what(123); // 'number'
what(12.3); // 'number'
 
what(true); // 'boolean'
what(false); // 'boolean'

3. LICENSE

MIT

Package Sidebar

Install

npm i what.js

Weekly Downloads

133

Version

1.0.1

License

MIT

Last publish

Collaborators

  • atool