Simple and small library of utilities to validate, generate and format the RUT. Works with CJS and ESM
Install package:
# npm
npm install @rsgarate/rut
# yarn
yarn install @rsgarate/rut
# pnpm
pnpm install @rsgarate/rut
//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
- Clone this repository
- Install dependencies using pnpm install
To run tests, run the following command
pnpm test
Published under MIT License.
Made with 💛