Skip to content

ramsesgarate/rutjs

Repository files navigation

RutJS

Simple and small library of utilities to validate, generate and format the RUT. Works with CJS and ESM

Badges

npm version npm downloads Github Actions Codecov

Installation

Install package:

# npm
npm install @rsgarate/rut

# yarn
yarn install @rsgarate/rut

# pnpm
pnpm install @rsgarate/rut

Usage/Examples

//CJS
const {  clean, format, generate, getCheckDigit, isValid } = require('@rsgarate/rut')

//ESM
import {  clean, format, generate, getCheckDigit, isValid } from '@rsgarate/rut'


clean('16.155.435-9')   // '161554359'

format('161554359')    // '16.155.435-9'
format('161554359', {dashAlone: true})    // '16155435-9'

generate()    // 207377929

getCheckDigit('15255657')    // 8

isValid('161554359')    // true
isValid('161554358')    // false

Run Locally

  • Clone this repository
  • Install dependencies using pnpm install

Running Tests

To run tests, run the following command

  pnpm test

Authors

License

Published under MIT License.


Made with 💛

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published