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

multi-number-parse

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multi-number-parse - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

7

dist/index.js

@@ -46,3 +46,3 @@ 'use strict';

// analyze separators
var separators = stripped.match(/[^\d]/g).reduce(function (acc, sep, idx) {
var separators = (stripped.match(/[^\d]/g) || []).reduce(function (acc, sep, idx) {
var sepChr = 'str_' + sep.codePointAt(0);

@@ -61,2 +61,7 @@ var cnt = ((acc[sepChr] || {}).cnt || 0) + 1;

if (!sepKeys.length) {
// no separator, that's easy-peasy
return parseInt(stripped, 10) * (negative ? -1 : 1);
}
if (sepKeys.length > 2) {

@@ -63,0 +68,0 @@ // there's more than 2 separators, that's wrong

2

package.json
{
"name": "multi-number-parse",
"version": "1.0.3",
"version": "1.0.4",
"description": "Library for parsing numbers in any valid format.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -17,2 +17,5 @@ import { assert } from 'chai';

{ actual: '4.78€', expected: 4.78 },
{ actual: '28', expected: 28 },
{ actual: '-48', expected: -48 },
{ actual: '39USD', expected: 39 },
// some negative numbers

@@ -19,0 +22,0 @@ { actual: '-2,543.56', expected: -2543.56 },

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