Skip to content

Chilean rut js (javascript) npm package - Chilean Rut/Run validator and formatter js

License

Notifications You must be signed in to change notification settings

mihailpozarski/chilean-rutify-js

Repository files navigation

ChileanRutify

reviewdog rspec

Chilean Rutify is a javascript npm package that makes rut validations and manipulation easy

Installation

install chilean-rutify through npm:

npm install chilean-rutify

Usage

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"

Contributing

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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ChileanRutify project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.