Skip to content

Commit

Permalink
fix(createNumberMask): adds validation for the multiplier option
Browse files Browse the repository at this point in the history
  • Loading branch information
renato-bohler committed Jul 20, 2018
1 parent a0dac1c commit dcca4a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/createNumberMask.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ export default options => {
);
}

if (typeof multiplier !== 'number') {
throw new Error(
"The createNumberMask's option `multilpier` should be of type number.",
);
}

if (multiplier === 0) {
throw new Error(
"The createNumberMask's option `multilpier` cannot be zero.",
);
}

const format = storeValue => {
let number = storeValue;

Expand Down

0 comments on commit dcca4a1

Please sign in to comment.