Comparing version 0.1.1 to 0.2.0
'use strict'; | ||
var cheque = { | ||
module.exports = { | ||
@@ -37,3 +37,5 @@ isUndefined: function(x) { | ||
isArray: Array.isArray, | ||
isArray: Array.isArray || function(x) { | ||
return Object.prototype.toString.call(x) == '[object Array]'; | ||
}, | ||
@@ -45,3 +47,1 @@ isFunction: function(x) { | ||
}; | ||
module.exports = cheque; |
{ | ||
"name": "cheque", | ||
"version": "0.1.1", | ||
"description": "Type checking for when you only use JavaScript's Good Parts.", | ||
"version": "0.2.0", | ||
"description": "Type checking, for when you only use JavaScript's Good Parts.", | ||
"author": "Lim Yuan Qing", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
# Cheque.js [![npm Version](http://img.shields.io/npm/v/cheque.svg?style=flat)](https://www.npmjs.org/package/cheque) [![Build Status](https://img.shields.io/travis/yuanqing/cheque.svg?style=flat)](https://travis-ci.org/yuanqing/cheque) [![Coverage Status](https://img.shields.io/coveralls/yuanqing/cheque.svg?style=flat)](https://coveralls.io/r/yuanqing/cheque) | ||
> Type checking for when you only use JavaScript’s [Good Parts](https://youtu.be/hQVTIJBZook). | ||
> Type checking, for when you only use JavaScript’s [Good Parts](https://youtu.be/hQVTIJBZook). | ||
@@ -10,3 +10,3 @@ ## API | ||
var cheque = { | ||
module.exports = { | ||
@@ -45,3 +45,5 @@ isUndefined: function(x) { | ||
isArray: Array.isArray, | ||
isArray: Array.isArray || function(x) { | ||
return Object.prototype.toString.call(x) == '[object Array]'; | ||
}, | ||
@@ -53,11 +55,9 @@ isFunction: function(x) { | ||
}; | ||
module.exports = cheque; | ||
``` | ||
You must *not* do things like: | ||
You must *not* do terrible things like: | ||
```js | ||
var boo = new Boolean(true); | ||
var bad = new Number(42); | ||
var noo = new String('foo'); | ||
var noo = new String('foo'); | ||
``` | ||
@@ -72,3 +72,3 @@ | ||
[There are tests you can read.](https://github.com/yuanqing/cheque/blob/master/test) | ||
[There are lots of tests.](https://github.com/yuanqing/cheque/blob/master/test) | ||
@@ -85,2 +85,4 @@ ## Installation | ||
- 0.2.0 | ||
- Add polyfill for `Array.isArray` | ||
- 0.1.0 | ||
@@ -87,0 +89,0 @@ - Initial release |
'use strict'; | ||
var nativeIsArray = Array.isArray; | ||
Array.isArray = null; | ||
var tape = require('tape'); | ||
var fn = require('..').isArray; | ||
Array.isArray = nativeIsArray; | ||
tape('isArray', function(t) { | ||
@@ -7,0 +12,0 @@ t.notOk(fn(undefined), 'undefined'); |
17540
366
89