Comparing version 0.2.0 to 0.2.1
@@ -10,3 +10,5 @@ /** | ||
module.exports = function validate (expected, actual) { | ||
// TODO: make this the top-level method instead of rttc | ||
// and share common fn dependencies | ||
return rttc(expected, actual); | ||
}; |
{ | ||
"name": "rttc", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Runtime type-checking for JavaScript.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,21 +12,13 @@ var assert = require('assert'); | ||
}); | ||
it('should fail on null', function (){ | ||
assert.throws(function (){ | ||
coerce('string', null); | ||
}); | ||
it('should coerce to base type when it gets: null', function (){ | ||
assert.strictEqual(coerce('string', null), ''); | ||
}); | ||
it('should fail on NaN', function (){ | ||
assert.throws(function (){ | ||
coerce('string', NaN); | ||
}); | ||
it('should coerce to base type when it gets: NaN', function (){ | ||
assert.strictEqual(coerce('string', NaN), ''); | ||
}); | ||
it('should fail on Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('string', Infinity); | ||
}); | ||
it('should coerce to base type when it gets: Infinity', function (){ | ||
assert.strictEqual(coerce('string', Infinity), ''); | ||
}); | ||
it('should fail on -Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('string', -Infinity); | ||
}); | ||
it('should coerce to base type when it gets: -Infinity', function (){ | ||
assert.strictEqual(coerce('string', -Infinity), ''); | ||
}); | ||
@@ -68,21 +60,13 @@ it('should not touch arbitrary string', function() { | ||
}); | ||
it('should fail on null', function (){ | ||
assert.throws(function (){ | ||
coerce('number', null); | ||
}); | ||
it('should coerce to base type when it gets: null', function (){ | ||
assert.strictEqual(coerce('number', null), 0); | ||
}); | ||
it('should fail on NaN', function (){ | ||
assert.throws(function (){ | ||
coerce('number', NaN); | ||
}); | ||
it('should coerce to base type when it gets: NaN', function (){ | ||
assert.strictEqual(coerce('number', NaN), 0); | ||
}); | ||
it('should fail on Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('number', Infinity); | ||
}); | ||
it('should coerce to base type when it gets: Infinity', function (){ | ||
assert.strictEqual(coerce('number', Infinity), 0); | ||
}); | ||
it('should fail on -Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('number', -Infinity); | ||
}); | ||
it('should coerce to base type when it gets: -Infinity', function (){ | ||
assert.strictEqual(coerce('number', -Infinity), 0); | ||
}); | ||
@@ -116,21 +100,13 @@ it('should not touch positive integer', function (){ | ||
}); | ||
it('should fail on null', function (){ | ||
assert.throws(function (){ | ||
coerce('boolean', null); | ||
}); | ||
it('should coerce to base type when it gets: null', function (){ | ||
assert.strictEqual(coerce('boolean', null), false); | ||
}); | ||
it('should fail on NaN', function (){ | ||
assert.throws(function (){ | ||
coerce('boolean', NaN); | ||
}); | ||
it('should coerce to base type when it gets: NaN', function (){ | ||
assert.strictEqual(coerce('boolean', NaN), false); | ||
}); | ||
it('should fail on Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('boolean', Infinity); | ||
}); | ||
it('should coerce to base type when it gets: Infinity', function (){ | ||
assert.strictEqual(coerce('boolean', Infinity), false); | ||
}); | ||
it('should fail on -Infinity', function (){ | ||
assert.throws(function (){ | ||
coerce('boolean', -Infinity); | ||
}); | ||
it('should coerce to base type when it gets: -Infinity', function (){ | ||
assert.strictEqual(coerce('boolean', Infinity), false); | ||
}); | ||
@@ -154,1 +130,28 @@ it('should not touch true', function() { | ||
}); | ||
// TODO: harsh mode | ||
// it('should fail on null', function (){ | ||
// assert.throws(function (){ | ||
// coerce('string', null); | ||
// }); | ||
// }); | ||
// it('should fail on NaN', function (){ | ||
// assert.throws(function (){ | ||
// coerce('string', NaN); | ||
// }); | ||
// }); | ||
// it('should fail on Infinity', function (){ | ||
// assert.throws(function (){ | ||
// coerce('string', Infinity); | ||
// }); | ||
// }); | ||
// it('should fail on -Infinity', function (){ | ||
// assert.throws(function (){ | ||
// coerce('string', -Infinity); | ||
// }); | ||
// }); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
63146
0
1884