Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael Corradini da Cunha committed Sep 4, 2020
1 parent b5735d5 commit 7c61247
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
npm install --save react-masked
```

## Usage
## InputMask


### mask prop
Expand All @@ -32,24 +32,6 @@ import { InputMask } from 'react-masked'

<InputMask mask="999.999.999-99" clearIfNotMatch />
```

### Using functions to format strings

#### example
```javascript
import { fitToMask } from 'react-masked'

fitToMask('12332112312', '999.999.999-99') // returns '123.321.123-12'
```

#### example with custom patterns
```javascript
import { fitToMask } from 'react-masked'

fitToMask('12332112312', 'aaa.aaa.aaa-aa', { a: new RegExp('[0-9]') }) // returns '123.321.123-12'
```

## Patterns
### Default patterns:

```typescript
Expand Down Expand Up @@ -97,6 +79,39 @@ The patterns will be overwritten
```
example of input: 123.123.123-1199

## InputCurrency

### Example

```jsx
import { InputCurrency } from 'react-masked'

<InputCurrency
precision={4}
thousand="."
decimal=","
prefix="R$"
suffix="BRL"
/>
```
the numbers will be formatted like: R$ 1.000,00 BRL

## Functions to format strings

#### example
```javascript
import { fitToMask } from 'react-masked'

fitToMask('12332112312', '999.999.999-99') // returns '123.321.123-12'
```

#### example with custom patterns
```javascript
import { fitToMask } from 'react-masked'

fitToMask('12332112312', 'aaa.aaa.aaa-aa', { a: new RegExp('[0-9]') }) // returns '123.321.123-12'
```


## License

Expand Down

0 comments on commit 7c61247

Please sign in to comment.