Popcorn Tools

Installation
$ npm install popcorn-tools --save
How to use
ES6
import popcorn from 'popcorn-tools';
popcorn.measureFormat(1000);
UMD in Browser
<script src="popcorn-tools.umd.js"></script>
<script src="popcorn-tools.umd.min.js"></script>
After that the library will be available to the Global as PopcornTools
. Follow an example:
const data = popcorn.measureFormat(1000);
Methods
Follow the methods that the library provides.
popcorn.measureFormat(value)
Format numbers according to the unit of measurement.
Arguments
Example
const data = popcorn.measureFormat(1000);
popcorn.cpfValidate(cpf)
Valid if the number of a CPF (Individual Taxpayer Registration) is valid.
Arguments
Example
const valid = popcorn.cpfValidate(cpf);
popcorn.mobileCheck()
checks if the browser is on a mobile device..
Example
const check = popcorn.mobileCheck();
popcorn.currencyFormat(data)
Format a number for the desired currency.
Arguments
Argument | Type |
---|
value | number |
style | string |
currency | string |
Example
popcorn.currencyFormat({ currency: 'BRL', style: 'pt-BR', value: 10 })
popcorn.filter(array, value, param)
Filter an array of objects based on a string.
Arguments
Argument | Type |
---|
array | array |
value | string |
param | string |
Example
const data = [
{ value: 'Banana' },
{ value: 'Maçã' },
{ value: 'Laranja' },
{ value: 'Morango' },
{ value: 'Abacaxi' },
{ value: 'Mamão' },
];
const dataFilter = popcorn.filter(data, 'mam', 'value');
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details