1.0.4 • Published 7 years ago
cents-input v1.0.4
Cents Input
Handle money with cents input when it must start filling from decimal part.
Example:

How to use it
First, install cents-input package:
npm i cents-input
Then import it in your project:
import CentsInput from 'cents-input';Create an instance of the CentsInput class:
const instance = new CentsInput();Options
You can set a prefix and separator as options:
const instance = new CentsInput({
prefix: 'R$ ', // default is empty
separator: '.', // default is comma
});Methods
There are some methods available:
instance.addDigit(1);Add a digit to the current value. Put the value you want to add as a parameter.
instance.removeDigit();Remove a digit from the end of the current value.
instance.getFormatted();Return the formatted value, including the prefix.
instance.getFloat();Return the float value, without the prefix.
instance.reset();Reset the value.