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

int

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

int - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

4

HISTORY.md

@@ -0,1 +1,5 @@

# 0.2.0 (2014-11-25)
* become NaN when not a number
# 0.1.2 (2014-06-29)

@@ -2,0 +6,0 @@

@@ -17,2 +17,5 @@

// default value 0
num = num || 0;
// sign

@@ -24,5 +27,14 @@ self._s = ((num += '').charAt(0) === '-') ? 1 : 0;

num = num.replace(/^[+-]/, '');
var orig = num;
// remove any leading - or + as well as other invalid characters
num = num.replace(/[^\d]/g, '');
// detect if value is not a number
if (orig !== num) {
self._nan = true;
return;
}
// _d is the array of single digits making up the number

@@ -375,2 +387,6 @@ var ln = num.length;

if (self._nan) {
return NaN;
}
if (!radix || radix === 10) {

@@ -377,0 +393,0 @@ return (self._s && self._d.length ? '-' : '') + ((self._d.length) ? self._d.join('') : '0');

6

package.json

@@ -5,3 +5,3 @@ {

"description": "arbitrary precision integer and library in javascript",
"version": "0.1.2",
"version": "0.2.0",
"repository": {

@@ -19,4 +19,4 @@ "type": "git",

"devDependencies": {
"zuul": "~1.7.0",
"mocha": "~1.8.0"
"zuul": "~1.13.1",
"mocha": "~2.0.1"
},

@@ -23,0 +23,0 @@ "license": "MIT",

@@ -1,2 +0,1 @@

var assert = require('assert');

@@ -22,1 +21,9 @@ var int = require('../');

});
test('should become NaN with invalid values', function() {
var n1 = int('asd');
var n2 = int('1');
assert(!isNaN(n2));
assert(isNaN(n1));
});

Sorry, the diff of this file is not supported yet

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