import {
clean,
format,
getDigit,
isValid,
validate,
} from "https://deno.land/x/rutcl/mod.ts";
try {
validate("123456789");
} catch (error) {
console.error(error.message); // "RUT is not valid"
}
isValid("123456785"); // => true
getDigit(12345678); // => "5"
clean("12.345.678-5"); // => "123456785"
format("123456785"); // => "12.345.678-5"
Import functions from https://deno.land/x/rutcl/mod.ts
import { format, validate } from "https://deno.land/x/rutcl/mod.ts";
Or import a single function from /lib/
import clean from "https://deno.land/x/rutcl/lib/clean.ts";
Returns a boolean, true
if RUT is valid, false
otherwise.
import isValid from "https://deno.land/x/rutcl/lib/isValid.ts";
isValid(123456789); // => false
isValid("18591404-6"); // => true
Throws an InvalidRUTException
if RUT is not valid.
import validate from "https://deno.land/x/rutcl/lib/validate.ts";
validate(123456789); // => Throws InvalidRUTException
validate("18591404-6"); // => undefined
Returns a valid verification digit for given partial RUT
import getDigit from "https://deno.land/x/rutcl/lib/getDigit.ts";
getDigit("18591404"); // => "6"
Returns a formatted RUT
import format from "https://deno.land/x/rutcl/lib/format.ts";
format("185914046"); // => "18.591.404-6"
Returns a clean RUT, only digits.
import clean from "https://deno.land/x/rutcl/lib/clean.ts";
clean("0018*591.404*6"); // => "185914046"
TODO
TODO