lil'-type

Modern, reliable, full featured, type checking helpers (based on hu)
| Name | type |
| Version | 0.1.2 |
| Size | 2 KB / >1 KB (gzipped) |
| Environment | Node, Browser |
- Full type-checking support
- Support upcoming ES6 data types (Generators, Promise, Map, WeakMap...)
- Support for binary data types (Blob, File, FileReader...)
- Support for buffer data types (ArrayBuffer, DataView...)
- Support for typed arrays (Int8Array, Float32Array...)
- Smart type inference
npm install lil-typeVia Bower
bower install lil-typeVia Component
component install lil-js/typeOr loading the script remotely
<script src="//cdn.rawgit.com/lil-js/type/0.1.2/type.js"></script>- Node.js
- Chrome >= 6
- Firefox >= 4
- Safari >= 5.1
- Opera >= 12
- IE >= 9
You could fetch de module via require() if it's available.
Otherwise, global fallback will be used, exposed via lil.type
var lil = require('lil-type')lil.isObject({}) // -> true
lil.isArray([1,2,3]) // -> true
lil.isNumber(1.2) // -> true
lil.isBool(1.2) // -> true
lil.isRegExp(/[a-z]/) // -> truelil.isEmpty(void 0) // -> true
lil.isEmpty('') // -> true
lil.isEmpty([]) // -> true
lil.isEmpty({}) // -> true
lil.isEmpty(1.5) // -> false
lil.isEmpty(new Date) // -> falselil.is('name') // -> 'string'
lil.is({}) // -> 'object'
lil.is([1]) // -> 'array'
lil.is(/[a-z]/) // -> 'regexp'
lil.is(function () {}) // -> 'function'
lil.is(void 0) // -> 'undefined'lil.isIterable([1,2,3]) // -> true
lil.isIterable({ name: 'Chuck' }) // -> true
lil.isIterable(function () {}) // -> false
lil.isIterable(true) // -> false
lil.isMutable({}) // -> true
lil.isMutable([]) // -> true
lil.isMutable('') // -> false
lil.isMutable(/[a-z]/) // -> falseAlias: isBoolean
Alias: isFunction
Alias: isType
Wanna help? Cool! It will be appreciated :)
You must add new test cases for any new feature or refactor you do, always following the same design/code patterns that already exist
Only node.js is required for development
Clone the repository
$ git clone https://github.com/lil-js/type.git && cd typeInstall dependencies
$ npm installGenerate browser bundle source
$ make browserRun tests
$ make testMIT © Tomas Aparicio


