Chilean Rutify is a javascript npm package that makes rut validations and manipulation easy
install chilean-rutify
through npm:
npm install chilean-rutify
You can use the available utility methods by importing the default object:
import ChileanRutify from 'chilean-rutify';
// using an example rut '36.408.368-8'
let rut = '36408368-8';
ChileanRutify.normalizeRut(rut);
// 364083688
ChileanRutify.formatRut(rut);
// "36.408.368-8"
ChileanRutify.validRut(rut);
// true
ChileanRutify.validRutVerifier(rut)
// true
ChileanRutify.validRutValues(rut)
// true
rut = '36408368';
ChileanRutify.getRutVerifier(rut)
// "8"
or destructure each individual utility method:
import {
validRutValue,
validRutValues,
getRutVerifier,
validRutVerifier,
normalizeRut,
formatRut,
validRut
} from "chilean-rutify";
// using an example rut '36.408.368-8'
let rut = '36408368-8';
normalizeRut(rut);
// 364083688
formatRut(rut);
// "36.408.368-8"
validRut(rut);
// true
validRutVerifier(rut)
// true
validRutValues(rut)
// true
rut = '36408368';
getRutVerifier(rut)
// "8"
Bug reports and pull requests are welcome on GitHub at https://github.com/mihailpozarski/chilean-rutify-js. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the ChileanRutify project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.