Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rttc

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rttc - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

lib/validate.js

@@ -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);
};

2

package.json
{
"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);
// });
// });
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc