npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@roddyvitali/rut-utils

v1.0.2

Published

Utilities for RUT in Chile

Downloads

14

Readme

RUT Utils

Rol Único Tributario (RUT)

Each person registered in the database of the Civil Registry has its own RUT, that is unique and unrepeatable number that useful as a method of identification. This consists of an 8-digit number with a verification digit that can be from 0 to 9 or a K.

Description

The utilities for the use of the RUT number, consist in a set of tools that allow you to verify the validity of the number, give it a format, and obtain the full name and aditional information of a person that is linked to that Rut number.

Tools

  • Give Format a RUT
  • Clean the invalids characters RUT
  • Calculate the verifier digit
  • Verify if its a valid or invalid RUT
  • Get the number of 8 digits or the verifier digit from the RUT
  • Get the full name and additional information of a person from the RUT

Installation

npm install rut-utils --save

General Use

import RutUtils from 'rut-utils'

RutUtils.Format( rut: string, dots: boolean ) //Return string
RutUtils.Clean(rut: string) //Return string
RutUtils.Calculate(rut: string) //Return string
RutUtils.IsValid(rut: string) //Return boolean
RutUtils.Digits(rut: string) //Return string
RutUtils.Verifier(rut: string) //Return string
RutUtils.GetInfo(rut: string) //Return Object
RutUtils.GetInfo(data: string, searchForName: boolean) //Return Array

Examples

Give Format a RUT

Input: String Rut, boolean dots( true if you want a rut formatted with dots or false if you want without dots ) default is false

import { Format } from 'rut-utils'

Format("24541681", true) // Returns 2.454.168-1
Format("24541681") // Returns 2454168-1

Clean the invalids characters RUT

Input: String Rut

import { Clean } from 'rut-utils'

Clean("2.454.168-1") // Returns 24541681

Calculate the verifier digit

Input: String Rut

import { Calculate } from 'rut-utils'

Calculate("2.454.168") // Returns 1
Calculate("24541681") // Returns 1

Verify if its a valid or invalid RUT

Input: String Rut

import { IsValid } from 'rut-utils'

IsValid("2.454.168-1") // Returns true if is valid
IsValid("2.454.168-K") // Returns false if is invalid

Get the number of 8 digits from the RUT

Input: String Rut

import { Digits } from 'rut-utils'

Digits("2.454.168-1") // Returns 8-digits 2454168

Get the verifier digit from the RUT

Input: String Rut

import { Verifier } from 'rut-utils'

Verifier("2.454.168-1") // Returns verifier digit 1

Get object with the full name and additional info of a person from the RUT

Input: String data, Boolean ( false is for search by rut, default is false )

import { GetInfo } from 'rut-utils'

GetInfo("2.454.168-1") // Returns {"nombre":"Caceres Esteban","rut":"24541681","sexo":1}

Get array with the full name and additional info of a person from the a name person

Input: String data, Boolean ( true is for search by name )

import { GetInfo } from 'rut-utils'

GetInfo("Esteban Caceres", true) // Returns [{"name":"Caceres Esteban","rut":"24541681"}, ...]

Test

npm test

Credits

License