Rut validator is a javascript library for validate chilean ID.
npm install --save rut-validator-ca
const rutValidator = require('rut-validator-ca');
rutValidator('5998595-7') ==> True
rutValidator('5.998.595-7') ==> true
rutValidator('5998595-2') ==> False
rutValidator('5.998.595-2') ==> False
rutValidator('5998595-') ==> False
rutValidator('5998595') ==> False
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.