Skip to content

Commit

Permalink
Fix typo and some formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
tncalvert committed Dec 6, 2016
1 parent a3cca4f commit f44f1ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const CurrencyInput = React.createClass({
* Invoked once and cached when the class is created. Values in the mapping will be set on this.props if that
* prop is not specified by the parent component
*
* @returns {{onChange: onChange, value: string, decimalSeparator: string, thousandSeparator: string, precision: number, inputType: string, allowNegative: false}}
* @returns {{onChange: onChange, value: string, decimalSeparator: string, thousandSeparator: string, precision: number, inputType: string, allowNegative: boolean}}
*/
getDefaultProps(){
return {
Expand Down
6 changes: 3 additions & 3 deletions src/mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function mask(value, precision, decimalSeparator, thousandSeparat
if (precision > 20) {precision = 20;} // precision cannot greater than 20

let numberIsNegative = false;
if(allowNegative) {
if (allowNegative) {
let negativeSignCount = (value.match(/-/g) || []).length;
// number will be negative if we have an odd number of "-"
// ideally, we should only ever have 0, 1 or 2 (positive number, making a number negative
Expand All @@ -20,7 +20,7 @@ export default function mask(value, precision, decimalSeparator, thousandSeparat
// extract digits. if no digits, fill in a zero.
let digits = value.match(/\d/g) || ['0'];

if(allowNegative) {
if (allowNegative) {
// if every digit in the array is '0', then the number should
// never be negative
let allDigitsAreZero = true;
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function mask(value, precision, decimalSeparator, thousandSeparat

// if the number is negative, insert a "-" to
// the front of the array
if(allowNegative && numberIsNegative) {
if (allowNegative && numberIsNegative) {
digits.unshift('-');
}

Expand Down

0 comments on commit f44f1ed

Please sign in to comment.