Comparing version 0.2.4 to 0.2.5
10
index.js
@@ -561,3 +561,3 @@ | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a value value'); | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
@@ -579,3 +579,3 @@ return !is.infinite(value) && !is.infinite(other) && value >= other; | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a value value'); | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
@@ -597,3 +597,3 @@ return !is.infinite(value) && !is.infinite(other) && value > other; | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a value value'); | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
@@ -615,3 +615,3 @@ return !is.infinite(value) && !is.infinite(other) && value <= other; | ||
if (isActualNaN(value) || isActualNaN(other)) { | ||
throw new TypeError('NaN is not a value value'); | ||
throw new TypeError('NaN is not a valid value'); | ||
} | ||
@@ -633,3 +633,3 @@ return !is.infinite(value) && !is.infinite(other) && value < other; | ||
if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) { | ||
throw new TypeError('NaN is not a value value'); | ||
throw new TypeError('NaN is not a valid value'); | ||
} else if (!is.number(value) || !is.number(start) || !is.number(finish)) { | ||
@@ -636,0 +636,0 @@ throw new TypeError('all arguments must be numbers'); |
@@ -26,3 +26,3 @@ { | ||
"main": "index.js", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"scripts": { | ||
@@ -32,3 +32,3 @@ "test": "node test/index.js" | ||
"devDependencies": { | ||
"tape": "~0.3.3", | ||
"tap": "~0.4.1", | ||
"foreach": "~2.0.2" | ||
@@ -35,0 +35,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
var test = require('tape'); | ||
var test = require('tap').test; | ||
var is = require('../index.js'); | ||
@@ -278,4 +278,5 @@ | ||
t.false(is.maximum(2, [1, 2, 3]), '2 is not maximum of [1,2,3]'); | ||
t.throws(function () { return is.maximum(2, null); }, TypeError, 'throws when second value is not array-like'); | ||
t.throws(function () { return is.maximum(2, {}); }, TypeError, 'throws when second value is not array-like'); | ||
var error = new TypeError('second argument must be array-like'); | ||
t.throws(function () { return is.maximum(2, null); }, error, 'throws when second value is not array-like'); | ||
t.throws(function () { return is.maximum(2, {}); }, error, 'throws when second value is not array-like'); | ||
t.end(); | ||
@@ -289,4 +290,5 @@ }); | ||
t.false(is.minimum(2, [1, 2, 3]), '2 is not minimum of [1,2,3]'); | ||
t.throws(function () { return is.minimum(2, null); }, TypeError, 'throws when second value is not array-like'); | ||
t.throws(function () { return is.minimum(2, {}); }, TypeError, 'throws when second value is not array-like'); | ||
var error = new TypeError('second argument must be array-like'); | ||
t.throws(function () { return is.minimum(2, null); }, error, 'throws when second value is not array-like'); | ||
t.throws(function () { return is.minimum(2, {}); }, error, 'throws when second value is not array-like'); | ||
t.end(); | ||
@@ -341,4 +343,5 @@ }); | ||
t.false(is.ge(0, Infinity), 'anything is not greater than infinity'); | ||
t.throws(function () { return is.ge(NaN, 2); }, TypeError, 'throws when first value is NaN'); | ||
t.throws(function () { return is.ge(2, NaN); }, TypeError, 'throws when second value is NaN'); | ||
var error = new TypeError('NaN is not a valid value'); | ||
t.throws(function () { return is.ge(NaN, 2); }, error, 'throws when first value is NaN'); | ||
t.throws(function () { return is.ge(2, NaN); }, error, 'throws when second value is NaN'); | ||
t.end(); | ||
@@ -356,4 +359,5 @@ }); | ||
t.false(is.gt(0, Infinity), 'anything is not greater than infinity'); | ||
t.throws(function () { return is.gt(NaN, 2); }, TypeError, 'throws when first value is NaN'); | ||
t.throws(function () { return is.gt(2, NaN); }, TypeError, 'throws when second value is NaN'); | ||
var error = new TypeError('NaN is not a valid value'); | ||
t.throws(function () { return is.gt(NaN, 2); }, error, 'throws when first value is NaN'); | ||
t.throws(function () { return is.gt(2, NaN); }, error, 'throws when second value is NaN'); | ||
t.end(); | ||
@@ -371,4 +375,5 @@ }); | ||
t.false(is.le(0, Infinity), 'anything is not lesser than or equal to infinity'); | ||
t.throws(function () { return is.le(NaN, 2); }, TypeError, 'throws when first value is NaN'); | ||
t.throws(function () { return is.le(2, NaN); }, TypeError, 'throws when second value is NaN'); | ||
var error = new TypeError('NaN is not a valid value'); | ||
t.throws(function () { return is.le(NaN, 2); }, error, 'throws when first value is NaN'); | ||
t.throws(function () { return is.le(2, NaN); }, error, 'throws when second value is NaN'); | ||
t.end(); | ||
@@ -386,4 +391,5 @@ }); | ||
t.false(is.lt(0, Infinity), 'anything is not lesser than infinity'); | ||
t.throws(function () { return is.lt(NaN, 2); }, TypeError, 'throws when first value is NaN'); | ||
t.throws(function () { return is.lt(2, NaN); }, TypeError, 'throws when second value is NaN'); | ||
var error = new TypeError('NaN is not a valid value'); | ||
t.throws(function () { return is.lt(NaN, 2); }, error, 'throws when first value is NaN'); | ||
t.throws(function () { return is.lt(2, NaN); }, error, 'throws when second value is NaN'); | ||
t.end(); | ||
@@ -394,17 +400,20 @@ }); | ||
t.test('argument checking', function (st) { | ||
st.throws(function () { return is.within(NaN, 0, 0); }, TypeError, 'throws when first value is NaN'); | ||
st.throws(function () { return is.within(0, NaN, 0); }, TypeError, 'throws when second value is NaN'); | ||
st.throws(function () { return is.within(0, 0, NaN); }, TypeError, 'throws when third value is NaN'); | ||
st.throws(function () { return is.within('', 0, 0); }, TypeError, 'throws when first value is string'); | ||
st.throws(function () { return is.within(0, '', 0); }, TypeError, 'throws when second value is string'); | ||
st.throws(function () { return is.within(0, 0, ''); }, TypeError, 'throws when third value is string'); | ||
st.throws(function () { return is.within({}, 0, 0); }, TypeError, 'throws when first value is object'); | ||
st.throws(function () { return is.within(0, {}, 0); }, TypeError, 'throws when second value is object'); | ||
st.throws(function () { return is.within(0, 0, {}); }, TypeError, 'throws when third value is object'); | ||
st.throws(function () { return is.within(null, 0, 0); }, TypeError, 'throws when first value is null'); | ||
st.throws(function () { return is.within(0, null, 0); }, TypeError, 'throws when second value is null'); | ||
st.throws(function () { return is.within(0, 0, null); }, TypeError, 'throws when third value is null'); | ||
st.throws(function () { return is.within(undefined, 0, 0); }, TypeError, 'throws when first value is undefined'); | ||
st.throws(function () { return is.within(0, undefined, 0); }, TypeError, 'throws when second value is undefined'); | ||
st.throws(function () { return is.within(0, 0, undefined); }, TypeError, 'throws when third value is undefined'); | ||
var nanError = new TypeError('NaN is not a valid value'); | ||
st.throws(function () { return is.within(NaN, 0, 0); }, nanError, 'throws when first value is NaN'); | ||
st.throws(function () { return is.within(0, NaN, 0); }, nanError, 'throws when second value is NaN'); | ||
st.throws(function () { return is.within(0, 0, NaN); }, nanError, 'throws when third value is NaN'); | ||
var error = new TypeError('all arguments must be numbers'); | ||
st.throws(function () { return is.within('', 0, 0); }, error, 'throws when first value is string'); | ||
st.throws(function () { return is.within(0, '', 0); }, error, 'throws when second value is string'); | ||
st.throws(function () { return is.within(0, 0, ''); }, error, 'throws when third value is string'); | ||
st.throws(function () { return is.within({}, 0, 0); }, error, 'throws when first value is object'); | ||
st.throws(function () { return is.within(0, {}, 0); }, error, 'throws when second value is object'); | ||
st.throws(function () { return is.within(0, 0, {}); }, error, 'throws when third value is object'); | ||
st.throws(function () { return is.within(null, 0, 0); }, error, 'throws when first value is null'); | ||
st.throws(function () { return is.within(0, null, 0); }, error, 'throws when second value is null'); | ||
st.throws(function () { return is.within(0, 0, null); }, error, 'throws when third value is null'); | ||
st.throws(function () { return is.within(undefined, 0, 0); }, error, 'throws when first value is undefined'); | ||
st.throws(function () { return is.within(0, undefined, 0); }, error, 'throws when second value is undefined'); | ||
st.throws(function () { return is.within(0, 0, undefined); }, error, 'throws when third value is undefined'); | ||
st.end(); | ||
@@ -411,0 +420,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42057
1063