npm.io
1.0.3 • Published 6 years ago

validate-rut-serie

Licence
MIT
Version
1.0.3
Deps
3
Size
5 kB
Vulns
25
Weekly
0
Stars
18

Validate rut

Tool for validate rut with document number in Chile

Starting

How to install

First install with npm

npm i validate-rut-serie

Or yarn

yarn add validate-rut-serie

Using the tool

First import the tool, then call the async method isValid, sending an object with rut and serie (without points), it will return an boolean

Example
const { isValid } = require("validate-rut-serie")

async function tellIfIsValid() {
    const valid = await isValid({rut:"11.111.111-1", serie:"123456789"})
    console.log(valid) // return true if is valid, or false if is invalid
}

tellIfIsValid()
Valid formats for serie

The only format is 9 numbers of the number document, without points, string format

Valid formats for rut
// valids
('18.972.631-7')
('18972631-7')
('189726317')
('9.068.826-k')
('9068826-k')
('9068826k')

// invalids
('18.972.631-0')
('18,972,631-7')
('18*972*631-7')
('18-972-631-7')
('error18.972.631-7')
('9068826-1')
('')
(189726317)
('0')
(0)

Building with:

  • rut.js - Tool for validate RUT
  • axios - To request if the rut is valid (to chilean servers)

Authors

  • Christian Rodriguez - Inforser - crod

Licence

MIT

Thanks

  • Thanks for read this readme!

with for crod-inforser

Keywords