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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mafesoftware/clientes

v0.1.0

Published

Validacion de documento (DNI/CUIT) y normalizacion para detectar duplicados (email/telefono/documento) de clientes o prospectos. Nucleo puro: sin DB ni framework, compone @mafesoftware/documentos-ar para el digito verificador.

Readme

@mafesoftware/clientes

Validación de documento (DNI/CUIT) y normalización para detectar duplicados (email, teléfono, documento) de clientes o prospectos — para los productos de MAFE Software que dan de alta clientes/prospectos y necesitan avisar "ya existe uno con este documento/teléfono/email" antes de insertar, o alimentar una sugerencia de fusión.

Núcleo puro: sin DB ni framework. Compone @mafesoftware/documentos-ar para el algoritmo del dígito verificador — este paquete nunca lo reimplementa.

bun add @mafesoftware/clientes

API

validarDocumentoCliente(tipo, valor): ResultadoDocumentoCliente

Valida y normaliza un DNI o un CUIT. Nunca tira.

type TipoDocumentoCliente = 'dni' | 'cuit';
type ResultadoDocumentoCliente = { ok: true; normalizado: string } | { ok: false; mensaje: string };
import { validarDocumentoCliente } from '@mafesoftware/clientes';

validarDocumentoCliente('dni', '12.345.678');
// { ok: true, normalizado: "12345678" }

validarDocumentoCliente('cuit', '20-12345678-7');
// { ok: false, mensaje: "..." } — dígito verificador inválido

normalizarTelefono(telefono): string

Normaliza un teléfono argentino para comparar duplicados: solo dígitos, sin el código de país (54), sin el 9 de celular, sin el 0 de discado local — así "+54 9 11 1234-5678" y "11 1234-5678" normalizan al mismo valor. Nunca tira: vacío o null/undefined normaliza a cadena vacía.

import { normalizarTelefono } from '@mafesoftware/clientes';

normalizarTelefono('+54 9 11 1234-5678'); // "1112345678"
normalizarTelefono('11 1234-5678'); // "1112345678"

esMismoTelefono(a, b): boolean

¿Dos teléfonos son el mismo número, normalizados? Dos cadenas vacías nunca "coinciden" entre sí (no hay nada que comparar) — evita marcar como duplicados dos registros que simplemente no cargaron el teléfono.

import { esMismoTelefono } from '@mafesoftware/clientes';

esMismoTelefono('+54 9 11 1234-5678', '11 1234-5678'); // true
esMismoTelefono('', ''); // false

normalizarDni(dni): string

Normaliza un DNI/documento a solo dígitos, para comparar duplicados.

normalizarEmail(email): string

Normaliza un email para comparar duplicados: minúsculas, sin espacios de borde.

import { normalizarDni, normalizarEmail } from '@mafesoftware/clientes';

normalizarDni('12.345.678'); // "12345678"
normalizarEmail('  [email protected] '); // "[email protected]"

Lo que este paquete NO hace

La fusión en sí (mover cuenta corriente, reservas, prospectos u otras tablas del cliente perdedor al ganador, y archivar al perdedor con un puntero) es lógica transaccional atada al schema de cada app — no hay una parte pura de eso para extraer acá. Cada app implementa su propio fusionarClientes/fusionarProspectos usando estas utilidades solo para detectar el duplicado antes de fusionar, no para ejecutar la fusión.