1.0.1 • Published 8 years ago

what.js v1.0.1

Weekly downloads
25
License
MIT
Repository
github
Last release
8 years ago

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