https://github.com/lavesan/function-masks
Function masks to be used by any variable, like input in a website
https://github.com/lavesan/function-masks
babel gulp masks
Last synced: 2 months ago
JSON representation
Function masks to be used by any variable, like input in a website
- Host: GitHub
- URL: https://github.com/lavesan/function-masks
- Owner: lavesan
- Created: 2020-09-04T13:32:29.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-13T16:42:38.000Z (over 4 years ago)
- Last Synced: 2025-03-13T08:36:50.243Z (2 months ago)
- Topics: babel, gulp, masks
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/function-masks
- Size: 48.8 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Function masks
Function masks to be used by any variable, like inputs in a website
If there's some bug/feature, submit a Issue :D
## Pre-requisites
- node
## Installing
> npm i --save function-masks
or with yarn
> yarn add function-masks
## Usage
```javascript
import { onlyNumberMask, maxLengthMask } from 'function-masks'const string1 = 'string with some numbers 123'
console.log(onlyNumberMask(string1)) // -> Output: 123const string2 = "string-with more digits than it's permitted"
console.log(maxLengthMask(6)(string2)) // -> Output: string
```## Functions
|name |parameters|description |
|--------------|----------|--------------------------------|
|onlyNumberMask|(value: string) |Returns string with only numbers|
|cpfMask|(value: string) |Returns string with cpf format '000-000-000-00'|
|maxLengthMask|(length: number)(value: string) |Returns string with limited length|
|onlyCharactersMask|(value: string) |Returns string with only characters and special characters|
|celphoneMask|(value: string) |Returns string with celphone format '(00) 00000-0000'|
|telephoneMask|(value: string) |Returns string with telephone format '(00) 0000-0000'|
|onlyNumberStringToThreeDigit|(value: string) |Returns string with three digit dots format '0,000'|
|percentageMask|(value: string) |Returns string with only integer percentage format '0%'|
|cardNumberMask|(value: string) |Returns string with card format '0000 0000 0000 0000'|
|moneyMask|(value: string) |Returns string with br money format 'R$ 0,00'|
|cepMask|(value: string) |Returns string with cep format '00000-000'|