Socket
Socket
Sign inDemoInstall

parse-decimal-number

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.1.1

24

.verbrc.md

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

---
username: AndreasPizsa
license_: MIT
---
# {%= name %} {%= badge('fury') %} {%= badge('travis') %}
# {%= name %} ![Travis](https://img.shields.io/travis/AndreasPizsa/{%= name %}.svg?style=flat-square) [![Coverage Status](https://img.shields.io/coveralls/AndreasPizsa/{%= name %}.svg?style=flat-square)](https://coveralls.io/github/AndreasPizsa/{%= name %}?branch=master) ![Downloads](https://img.shields.io/npm/dm/{%= name %}.svg?style=flat-square)
> {%= description %}

@@ -21,21 +17,17 @@

## Issues
{%= include("report-issues") %}
## Running tests
{%%= include("tests") %}
## Contributing
{%= include("contributing") %}
## Author
{% if(typeof authors !== 'undefined') { %}{%= include("authors") %}
{% } else { %}{%= include("author") %}{% } %}
{%= include("author") %}
{% if(typeof contributors !== 'undefined') {%}## Contributors
{%= include("contributors") %}
{% } %}
## License
{%= copyright() %}
Released under the [{%= license_ %} license](LICENSE-MIT).
{%= license() %}
***
{%= include("footer") %}

@@ -35,3 +35,3 @@ (function() {

if (!pattern) {
pattern = patterns[patternIndex] = new RegExp('^\\s*((?:\\d{1,3}(?:\\' + thousands + '\\d{3})+)|\\d*)(?:\\' + decimal + '(\\d*))?\\s*$');
pattern = patterns[patternIndex] = new RegExp('^\\s*(-?(?:(?:\\d{1,3}(?:\\' + thousands + '\\d{3})+)|\\d*))(?:\\' + decimal + '(\\d*))?\\s*$');
}

@@ -44,3 +44,3 @@ result = value.match(pattern);

fractionPart = result[2];
number = parseFloat("" + integerPart + "." + fractionPart);
number = parseFloat(integerPart + "." + fractionPart);
return number;

@@ -47,0 +47,0 @@ };

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

(function(){var a,b;b=[],a={},module.exports=function(c,d){var e,f,g,h,i,j,k,l;if("string"==typeof d){if(2!==d.length)throw{name:"ArgumentException",message:"The format for string options is '<thousands><decimal>' (exactly two characters)"};l=d[0],e=d[1]}else if(d instanceof Array){if(2!==d.length)throw{name:"ArgumentException",message:"The format for array options is ['<thousands>','[<decimal>'] (exactly two elements)"};l=d[0],e=d[1]}else l=(null!=d?d.thousands:void 0)||a.thousands,e=(null!=d?d.decimal:void 0)||a.decimal;return j=""+l+e,i=b[j],i||(i=b[j]=new RegExp("^\\s*((?:\\d{1,3}(?:\\"+l+"\\d{3})+)|\\d*)(?:\\"+e+"(\\d*))?\\s*$")),k=c.match(i),k&&3===k.length?(g=k[1].replace(new RegExp("\\"+l,"g"),""),f=k[2],h=parseFloat(""+g+"."+f)):0/0},module.exports.setOptions=function(b){var c,d;for(c in b)d=b[c],a[c]=d},module.exports.factoryReset=function(){return a={thousands:",",decimal:"."}},module.exports.factoryReset()}).call(this);
(function(){var a,b;b=[],a={},module.exports=function(c,d){var e,f,g,h,i,j,k,l;if("string"==typeof d){if(2!==d.length)throw{name:"ArgumentException",message:"The format for string options is '<thousands><decimal>' (exactly two characters)"};l=d[0],e=d[1]}else if(d instanceof Array){if(2!==d.length)throw{name:"ArgumentException",message:"The format for array options is ['<thousands>','[<decimal>'] (exactly two elements)"};l=d[0],e=d[1]}else l=(null!=d?d.thousands:void 0)||a.thousands,e=(null!=d?d.decimal:void 0)||a.decimal;return j=""+l+e,i=b[j],i||(i=b[j]=new RegExp("^\\s*(-?(?:(?:\\d{1,3}(?:\\"+l+"\\d{3})+)|\\d*))(?:\\"+e+"(\\d*))?\\s*$")),k=c.match(i),k&&3===k.length?(g=k[1].replace(new RegExp("\\"+l,"g"),""),f=k[2],h=parseFloat(g+"."+f)):NaN},module.exports.setOptions=function(b){var c,d;for(c in b)d=b[c],a[c]=d},module.exports.factoryReset=function(){return a={thousands:",",decimal:"."}},module.exports.factoryReset()}).call(this);
{
"name": "parse-decimal-number",
"version": "0.0.1",
"version": "0.1.1",
"description": "Parse a decimal number with i18n format support (localized decimal points and thousands separators)",
"main": "./dist/parse-decimal-number.js",
"scripts": {
"test": "gulp test"
"test": "gulp coveralls"
},

@@ -13,2 +13,5 @@ "repository": {

},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"keywords": [

@@ -38,5 +41,7 @@ "parse",

"devDependencies": {
"gulp": "^3.8.8",
"coffee-script": "^1.8.0",
"gulp": "^3.9.1",
"gulp-blanket-mocha": "0.0.4",
"gulp-coffee": "^2.2.0",
"gulp-coveralls": "^0.1.4",
"gulp-istanbul": "^0.3.1",

@@ -47,5 +52,5 @@ "gulp-mocha": "^1.1.0",

"gulp-verb": "^0.3.0",
"lodash": "^2.4.1",
"verb": "^0.2.15"
"lodash": "*",
"verb": "^0.8.10"
}
}

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

# parse-decimal-number [![NPM version](https://badge.fury.io/js/parse-decimal-number.svg)](http://badge.fury.io/js/parse-decimal-number)
[![Build Status](https://travis-ci.org/AndreasPizsa/parse-decimal-number.svg)](https://travis-ci.org/AndreasPizsa/parse-decimal-number)
# parse-decimal-number ![Travis](https://img.shields.io/travis/AndreasPizsa/parse-decimal-number.svg?style=flat-square) [![Coverage Status](https://img.shields.io/coveralls/AndreasPizsa/parse-decimal-number.svg?style=flat-square)](https://coveralls.io/github/AndreasPizsa/parse-decimal-number?branch=master) ![Downloads](https://img.shields.io/npm/dm/parse-decimal-number.svg?style=flat-square)
> Parse a decimal number with i18n format support (localized decimal points and thousands separators)

@@ -11,7 +9,7 @@

* **Simple.** String in, float out, done.
* **Lightweight.** (0.5k minified)
* **Accurate.** Parses numbers and returns `NaN` for non-numbers. (=great for UI validation)
* **Complete.** No external dependencies
* **Reliable.** 100% Code Coverage
* **Simple.** String in, float out, done. ✓
* **Accurate.** Parses numbers and returns `NaN` for non-numbers. (=good for input validation) ✓
* **Lightweight.** (<1k minified) ✓
* **Complete.** No external dependencies ✓
* **Solid.** 100% Code Coverage ✓

@@ -129,5 +127,9 @@ In it’s simplest form, you just use it as a `parseFloat` replacement.

## Issues
Please [report any bugs or feature requests](https://github.com/AndreasPizsa/parse-decimal-number/issues/new), thanks!
## Running tests
{%= include("tests") %}
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality, and please re-build the documentation with [gulp-verb](https://github.com/assemble/gulp-verb) before submitting a pull request.
## Author

@@ -140,7 +142,4 @@

## License
Copyright (c) 2014 Andreas Pizsa (http://github.com/AndreasPizsa), contributors.
Released under the [MIT license](LICENSE-MIT).
Copyright (c) 2016 Andreas Pizsa (http://github.com/AndreasPizsa), contributors.

@@ -150,2 +149,2 @@

_This file was generated by [gulp-verb](https://github.com/assemble/gulp-verb) on October 04, 2014._
_This file was generated by [gulp-verb](https://github.com/assemble/gulp-verb) on February 10, 2016._

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc