cb-rut-helpers
v1.0.4
Published
Validar formato de rut Chileno y formatearlo
Downloads
3
Readme
Rut Helpers
Helpers to validate and format strings to RUT (Chilean DNI).
Installation
npm install cb-rut-helpers --save
Use
// You can import everything
import * as rutHelpers from 'cb-rut-helpers';
// Or import only what you need.
import { rutValidate, rutFormat } from 'cb-rut-helpers';
// Or with node
var rutHelpers = require('cb-rut-helpers');
Validating RUTs
rutHelpers.rutValidate('THIS IS A RUT');
// false
rutHelpers.rutValidate('18.016.884-2');
// true
rutHelpers.rutValidate('180168842');
// true
Formatting strings as RUTs
rutHelpers.rutFormat('180168842');
// 7.618.285-K
Cleaning RUTs
rutHelpers.rutClean('18.016.884-2');
// 7618285K