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

react-numeral-input

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-numeral-input - npm Package Compare versions

Comparing version 0.0.9 to 0.1.0

index.html

28

dist/index.js

@@ -49,2 +49,10 @@ // Generated by CoffeeScript 1.9.3

},
formatPos: function(val, index) {
var dotCount, sub;
val = numeral().unformat(val);
val = numeral(val).format(this.props.fmt);
sub = val.substr(0, index);
dotCount = sub.split(',').length - 1;
return index - dotCount;
},
focusOnChar: function(val, index) {

@@ -58,5 +66,2 @@ var char, dotCount, finalIndex, formatVal, i;

char = formatVal[i];
if (char === ',') {
dotCount++;
}
if (i === (index + dotCount)) {

@@ -66,4 +71,10 @@ finalIndex = i;

}
if (char === ',') {
dotCount++;
}
i++;
}
if (!finalIndex) {
finalIndex = 1;
}
return finalIndex;

@@ -98,12 +109,17 @@ },

changeHandler: function() {
var node, pos, reTest, val;
var node, oVal, pos, reTest, val;
node = this.getDOMNode();
val = node.value;
pos = getCaretPosition(node);
pos = this.formatPos(this.state.value, pos);
reTest = re.test(val);
if (!reTest) {
val = numeral(val).value();
if ((this.state.value + '').length <= (val + '').length) {
oVal = numeral(this.state.val);
if ((oVal + '').length < (val + '').length) {
pos = this.focusOnChar(val, pos++);
} else if ((oVal + '').length > (val + '').length) {
pos = this.focusOnChar(val, pos--);
} else {
pos = this.focusOnChar(val, pos);
pos++;
}

@@ -110,0 +126,0 @@ }

{
"name": "react-numeral-input",
"description": "numeral input",
"version": "0.0.9",
"version": "0.1.0",
"author": "Bingo Yang <blackbing@gmail.com>",

@@ -6,0 +6,0 @@ "browserify": {

Sorry, the diff of this file is too big to display

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