@dgitals/rut
v1.0.2
Published
Just another toolkit library for validating/formatting RUTs
Downloads
21
Maintainers
Readme
@dgitals/rut
🇨🇱 Just another toolkit library for validating/formatting RUTs
Don't know what a RUT is? read this.
Installation
Using npm:
$ npm i @dgitals/rut
Using yarn:
$ yarn add @dgitals/rut
Usage: Cleaning a RUT
...
import { clean } from '@dgitals/rut'
...
clean('18.722.577-9') // returns 187225779
clean('0187225779') // returns 187225779
clean('7.903.486-k') // returns 7903486K
Usage: Validating a RUT
...
import { validate } from '@dgitals/rut'
...
validate('18.722.577-9') // returns true
validate('7903486k') // returns true
validate('nope18.722.577-9') // returns false
validate(187225779) // returns false (RUT is ok, but needs to be a String)
Usage: Formatting a RUT
...
import { format } from '@dgitals/rut'
...
clean('7903486-k') // returns 7.903.486-k
clean('18*722*577*9') // returns 18.722.577-9
clean('187225779') // returns 18.722.577-9
Note: all methods above MUST receive a String parameter as RUT
Testing
$ yarn install
$ yarn test
Issues
If you find a bug, please file an issue on our issue tracker on GitHub.
Credits
@dgitals/rut is built and maintained by Dgitals, Inc.