Skip to main content

Getting Started

dr-utils is a zero-dependency TypeScript library for utilities relevant to the Dominican Republic: validation, formatting, parsing, masking, ITBIS tax calculations, currency formatting, and more.

note

There are Cédulas/RNCs that give false negatives (a valid cédula fails validation) due to not matching the Luhn algorithm. The Dominican Government / DGII may have started issuing cédulas under a different algorithm or with unknown exceptions. The calculated failure rate using the public RNC database is approximately 0.01%.

Installation

npm i dr-utils
yarn add dr-utils
pnpm add dr-utils
bun add dr-utils

Import Paths

Every module is tree-shakeable and available as a named sub-path:

Sub-pathContents
dr-utilsEverything (re-exports all below)
dr-utils/validatorsvalidateCedula, validateRNC, validateNCF, validatePhoneNumber, validatePlate
dr-utils/formattersformatCedula, formatRNC, formatNCF, formatPhoneNumber, formatPlate, formatDOP
dr-utils/parsersparseCedula, parseRNC, parseNCF, parsePhoneNumber, normalizePhoneNumber, parsePlate, safeParse*
dr-utils/masksmaskCedula, maskRNC, maskPhoneNumber
dr-utils/helpersgetMunicipiosByProvincia, getProvinciaByMunicipio, amountToWords, applyItbis, removeItbis, splitItbis
dr-utils/constantsProvincias, MunicipiosPorProvincia, ITBIS_RATE, PLATE_CATEGORIES, …
dr-utils/typesParsedCedula, ParsedRNC, ParsedNCF, ParsedPhoneNumber, ParsedPlate, Result, …
dr-utils/errorsDrUtilsError, DrUtilsErrorCode