Verify chilean RUTs (Rol Único Tributario).
MIT License
This module will help you verify chilean RUTs (Rol Único Tributario).
-Now using promises instead of callbacks
-Function callback is now in a standard format (error first callback).
Sample usage:
V3+
var rutVerifier = require('rut-verifier')
rutVerifier.verify('198765430')
.then(isValid=>console.log(isValid?'VALID RUT':'INVALID RUT')
.catch(console.error)
rutVerifier.getDigit(19876543)
.then(digit=>console.log(digit)) //0
.catch(console.error)
V2
var rutVerifier = require('rut-verifier')
rutVerifier.verify('198765430', function (err, isValid) {
if (err) {
return console.error(err)
}
if (isValid) {
console.log('VALID RUT')
} else {
console.log('INVALID RUT')
}
})
rutVerifier.getDigit(19876543, function(err, digit){
if(err){
return console.error(err)
}
console.log(digit) //0
})
Install the dependency
npm install rut-verifier --save
Mocha and Chai are used for testing. To run the tests:
npm test
Email me to [email protected]
If you want to contribute, open a new issue or fork the repository and add a pull request
Read LICENSE.md