A small collection of helpers to validate and format strings to RUT (Chilean DNI).
npm install rut-helpers --save
or with Yarn
yarn add rut-helpers
// You can import everything
import * as rutHelpers from 'rut-helpers';
// Or import only what you need.
import { rutValidate, rutFormat } from 'rut-helpers';
// Or with node
var rutHelpers = require('rut-helpers');
rutHelpers.rutValidate('THIS IS A RUT');
// false
rutHelpers.rutValidate('7.618.285-K');
// true
rutHelpers.rutValidate('7618285K');
// true
rutHelpers.rutFormat('7618285K');
// 7.618.285-K
rutHelpers.rutClean('7.618.285-K');
// 7618285K
If you want to add functionality please go to the contributing
Thank you contributors!
rut-helpers is maintained by platanus.
Potassium is © 2017 platanus, spa. It is free software and may be redistributed under the terms specified in the LICENSE file.