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

num

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

num - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

4

HISTORY.md

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

# 0.3.0 (2014-11-25)
* return NaN when not a number
# 0.2.3 (2014-08-23)

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

17

num.js

@@ -17,2 +17,3 @@ var int = require('int');

num = num || 0;
// convert to a string

@@ -37,4 +38,5 @@ num = '' + num;

this._int = int(num);
this._precision = prec || precision;
self._int = int(num);
self._precision = prec || precision;
self._nan = self._int._nan;
}

@@ -44,7 +46,12 @@

Num.prototype.toString = function() {
var self = this;
var num_str = this._int.toString();
if (self._nan) {
return NaN;
}
var num_str = self._int.toString();
// 0 precision, just return the int
if (this._precision <= 0) {
if (self._precision <= 0) {
return num_str;

@@ -62,3 +69,3 @@ }

// find index where to add the decimal point
var idx = num_str.length - this._precision;
var idx = num_str.length - self._precision;

@@ -65,0 +72,0 @@ // insert the proper number of 0s after the .

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

"description": "arbitrary precision integer and decimal library in javascript",
"version": "0.2.3",
"version": "0.3.0",
"repository": {

@@ -20,3 +20,3 @@ "type": "git",

"dependencies": {
"int": "0.1.2"
"int": "0.2.0"
},

@@ -23,0 +23,0 @@ "devDependencies": {

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