UNPKG

mexican-utils

Version:

Library that handles validations for several Mexican related fields

1 lines 19.4 kB
{"version":3,"sources":["../src/utils/curp-utils.ts","../src/utils/index.ts","../src/index.ts"],"sourcesContent":["export const GENDERS = {\r\n\tmale: \"H\",\r\n\tfemale: \"M\",\r\n} as const;\r\n\r\nexport type Gender = keyof typeof GENDERS;\r\n\r\nexport const STATES = {\r\n\taguascalientes: \"AS\",\r\n\tbaja_california: \"BC\",\r\n\tbaja_california_sur: \"BS\",\r\n\tcampeche: \"CC\",\r\n\tchiapas: \"CS\",\r\n\tchihuahua: \"CH\",\r\n\tciudad_de_méxico: \"DF\",\r\n\tcoahuila_de_zaragoza: \"CL\",\r\n\tcolima: \"CM\",\r\n\tdurango: \"DG\",\r\n\tguanajuato: \"GT\",\r\n\tguerrero: \"GR\",\r\n\thidalgo: \"HG\",\r\n\tjalisco: \"JC\",\r\n\tméxico: \"MC\",\r\n\tmichoacán_de_ocampo: \"MN\",\r\n\tmorelos: \"MS\",\r\n\tnayarit: \"NT\",\r\n\tnuevo_león: \"NL\",\r\n\toaxaca: \"OC\",\r\n\tpuebla: \"PL\",\r\n\tquerétaro: \"QT\",\r\n\tquintana_roo: \"QR\",\r\n\tsan_luis_potosí: \"SP\",\r\n\tsinaloa: \"SL\",\r\n\tsonora: \"SR\",\r\n\ttabasco: \"TC\",\r\n\ttamaulipas: \"TS\",\r\n\ttlaxcala: \"TL\",\r\n\tveracruz_de_ignacio_de_la_llave: \"VZ\",\r\n\tyucatán: \"YN\",\r\n\tzacatecas: \"ZS\",\r\n\tno_especificado: \"NE\",\r\n} as const;\r\n\r\nexport type State = keyof typeof STATES;\r\n\r\nconst COMMON_NAMES = [\r\n\t\"MARIA DEL \",\r\n\t\"MARIA DE LOS \",\r\n\t\"MARIA \",\r\n\t\"JOSE DE \",\r\n\t\"JOSE \",\r\n\t\"MA. \",\r\n\t\"MA \",\r\n\t\"M. \",\r\n\t\"J. \",\r\n\t\"J \",\r\n\t\"M \",\r\n] as const;\r\n\r\nconst BAD_WORDS: Record<string, string> = {\r\n\tBACA: \"BXCA\",\r\n\tBAKA: \"BXKA\",\r\n\tBUEI: \"BXEI\",\r\n\tBUEY: \"BXEY\",\r\n\tCACA: \"CXCA\",\r\n\tCACO: \"CXCO\",\r\n\tCAGA: \"CXGA\",\r\n\tCAGO: \"CXGO\",\r\n\tCAKA: \"CXKA\",\r\n\tCAKO: \"CXKO\",\r\n\tCOGE: \"CXGE\",\r\n\tCOGI: \"CXGI\",\r\n\tCOJA: \"CXJA\",\r\n\tCOJE: \"CXJE\",\r\n\tCOJI: \"CXJI\",\r\n\tCOJO: \"CXJO\",\r\n\tCOLA: \"CXLA\",\r\n\tCULO: \"CXLO\",\r\n\tFALO: \"FXLO\",\r\n\tFETO: \"FXTO\",\r\n\tGETA: \"GXTA\",\r\n\tGUEI: \"GXEI\",\r\n\tGUEY: \"GXEY\",\r\n\tJETA: \"JXTA\",\r\n\tJOTO: \"JXTO\",\r\n\tKACA: \"KXCA\",\r\n\tKACO: \"KXCO\",\r\n\tKAGA: \"KXGA\",\r\n\tKAGO: \"KXGO\",\r\n\tKAKA: \"KXKA\",\r\n\tKAKO: \"KXKO\",\r\n\tKOGE: \"KXGE\",\r\n\tKOGI: \"KXGI\",\r\n\tKOJA: \"KXJA\",\r\n\tKOJE: \"KXJE\",\r\n\tKOJI: \"KXJI\",\r\n\tKOJO: \"KXJO\",\r\n\tKOLA: \"KXLA\",\r\n\tKULO: \"KXLO\",\r\n\tLILO: \"LXLO\",\r\n\tLOCA: \"LXCA\",\r\n\tLOCO: \"LXCO\",\r\n\tLOKA: \"LXKA\",\r\n\tLOKO: \"LXKO\",\r\n\tMAME: \"MXME\",\r\n\tMAMO: \"MXMO\",\r\n\tMEAR: \"MXAR\",\r\n\tMEAS: \"MXAS\",\r\n\tMEON: \"MXON\",\r\n\tMIAR: \"MXAR\",\r\n\tMION: \"MXON\",\r\n\tMOCO: \"MXCO\",\r\n\tMOKO: \"MXKO\",\r\n\tMULA: \"MXLA\",\r\n\tMULO: \"MXLO\",\r\n\tNACA: \"NXCA\",\r\n\tNACO: \"NXCO\",\r\n\tPEDA: \"PXDA\",\r\n\tPEDO: \"PXDO\",\r\n\tPENE: \"PXNE\",\r\n\tPIPI: \"PXPI\",\r\n\tPITO: \"PXTO\",\r\n\tPOPO: \"PXPO\",\r\n\tPUTA: \"PXTA\",\r\n\tPUTO: \"PXTO\",\r\n\tQULO: \"QXLO\",\r\n\tRATA: \"RXTA\",\r\n\tROBA: \"RXBA\",\r\n\tROBE: \"RXBE\",\r\n\tROBO: \"RXBO\",\r\n\tRUIN: \"RXIN\",\r\n\tSENO: \"SXNO\",\r\n\tTETA: \"TXTA\",\r\n\tVACA: \"VXCA\",\r\n\tVAGA: \"VXGA\",\r\n\tVAGO: \"VXGO\",\r\n\tVAKA: \"VXKA\",\r\n\tVUEI: \"VXEI\",\r\n\tVUEY: \"VXEY\",\r\n\tWUEI: \"WXEI\",\r\n\tWUEY: \"WXEY\",\r\n} as const;\r\n\r\n/**\r\n * Removes propositions, contractions, or conjunctions from a compound name or surname\r\n * to calculate the CURP.\r\n * This function eliminates common Spanish prepositions (e.g., \"DE\", \"DEL\", \"LA\") that\r\n * should be ignored when processing compound names or surnames.\r\n * @param {string} input The compound name or surname to be adjusted.\r\n * @returns {string} The adjusted name or surname with propositions and conjunctions removed.\r\n */\r\nexport const removeCompoundWords = (input: string): string => {\r\n\tconst compoundWords =\r\n\t\t/\\b(DA|DAS|DE|DEL|DER|DI|DIE|DD|EL|LA|LOS|LAS|LE|LES|MAC|MC|VAN|VON|Y)\\b/gi;\r\n\r\n\t// Replace all matched prepositions, conjunctions, and contractions and trim excess spaces\r\n\treturn input.replace(compoundWords, \"\").replace(/\\s+/g, \" \").trim();\r\n};\r\n\r\n/**\r\n * Selects the valid first name to be used in CURP generation.\r\n * If the full name contains more than one given name and the first name is a common name\r\n * (e.g., \"MARIA\", \"JOSE\"), the second name will be used instead.\r\n * @param {string} name The full given name with multiple names separated by spaces.\r\n * @returns {string} The valid name to use for CURP generation.\r\n */\r\nexport const getPrimaryName = (name: string): string => {\r\n\t// Split the full name into individual names\r\n\tconst names = name.split(/\\s+/);\r\n\r\n\t// If there's only one name, return it\r\n\tif (names.length === 1) return names[0];\r\n\r\n\t// Check if the first name is a common name\r\n\tconst isCommonName = COMMON_NAMES.some((commonName) =>\r\n\t\tname.startsWith(commonName),\r\n\t);\r\n\r\n\t// If the first name is common, return the second name, otherwise return the first\r\n\treturn isCommonName ? names[1] : names[0];\r\n};\r\n\r\n/**\r\n * Replaces bad words with a predefined censored version.\r\n * If the input word matches a key in the `BAD_WORDS` list, it will be replaced by the corresponding value.\r\n * Otherwise, the original word is returned unchanged.\r\n * @param {string} word The word to check and potentially replace.\r\n * @returns {string} The censored version of the word if found, or the original word if not.\r\n */\r\nexport const replaceBadWords = (word: string): string => {\r\n\treturn BAD_WORDS[word.toUpperCase()] || word;\r\n};\r\n\r\nexport const getSpecialChar = (birthYear: string): \"0\" | \"A\" => {\r\n\treturn birthYear.startsWith(\"1\") ? \"0\" : \"A\";\r\n};\r\n\r\n/**\r\n * Calculates the verification digit for a CURP.\r\n * The verification digit is used to validate the CURP.\r\n * @param {string} incompleteCURP A string containing the first 17 characters of the CURP.\r\n * @returns {string} Returns the verification digit (0-9) for the CURP.\r\n */\r\nexport const calculateVerificationDigit = (incompleteCURP: string): string => {\r\n\tconst characterSet = \"0123456789ABCDEFGHIJKLMNÑOPQRSTUVWXYZ\";\r\n\tlet sum = 0;\r\n\r\n\tfor (let i = 0; i < 17; i++) {\r\n\t\tsum += characterSet.indexOf(incompleteCURP.charAt(i)) * (18 - i);\r\n\t}\r\n\r\n\tconst verificationDigit = 10 - (sum % 10);\r\n\treturn verificationDigit === 10 ? \"0\" : verificationDigit.toString();\r\n};\r\n","export * from \"./curp-utils\";\r\n\r\n/**\r\n * Normalize a string by converting to lowercase and removing accents.\r\n * This function will remove diacritical marks (accents) and normalize the string\r\n * by transforming it to lowercase.\r\n * @param {string} input The string to normalize.\r\n * @returns {string} The normalized string.\r\n */\r\nexport const normalizeString = (input: string): string => {\r\n\treturn (\r\n\t\tinput\r\n\t\t\t.toLowerCase()\r\n\t\t\t.trim()\r\n\t\t\t.normalize(\"NFD\") // Decompose combined graphemes into their component parts.\r\n\t\t\t// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>\r\n\t\t\t.replace(/[\\u0300-\\u036f]/g, \"\")\r\n\t); // Remove diacritical marks (accents).\r\n};\r\n\r\n/**\r\n * Replaces non-alphabetic characters in a string with a specified replacement string.\r\n * @param {string} input The string to be processed.\r\n * @param {string} replacement The string to replace non-alphabetic characters with.\r\n * @returns {string} The processed string with non-alphabetic characters replaced by the specified replacement string.\r\n */\r\nexport const replaceNonAlphabetic = (\r\n\tinput: string,\r\n\treplacement = \"X\",\r\n): string => {\r\n\treturn input.replace(/[\\d_\\-./\\\\,]/g, replacement);\r\n};\r\n\r\n/**\r\n * Finds the first consonant in a string.\r\n * If no consonant is found, returns 'X'.\r\n * @param {string} input The input string to search for consonants.\r\n * @returns {string} The first consonant found or 'X' if no consonant is present.\r\n */\r\nexport const findFirstConsonant = (input: string): string => {\r\n\tconst internalConsonant = input\r\n\t\t.substring(1) // Skip the first character\r\n\t\t.replace(/[AEIOU]/gi, \"\") // Remove vowels\r\n\t\t.charAt(0) // Get the first character (after removal)\r\n\t\t.trim(); // Trim any whitespace\r\n\r\n\treturn internalConsonant === \"\" || internalConsonant === \"Ñ\"\r\n\t\t? \"X\"\r\n\t\t: internalConsonant;\r\n};\r\n\r\n/**\r\n * Validates if the given argument is a valid date.\r\n * Accepts a string (in the format YYYY-MM-DD), a timestamp (number), or a Date object.\r\n * @param date - The date to validate, which can be a string, number, or Date.\r\n * @returns Whether the date is valid.\r\n */\r\nexport const isValidDate = (date: string | number | Date): boolean => {\r\n\tif (typeof date === \"string\") {\r\n\t\tconst regex = /^\\d{4}-\\d{2}-\\d{2}$/; // Check format YYYY-MM-DD\r\n\t\tif (!regex.test(date)) return false; // Format is invalid\r\n\r\n\t\tconst parsedDate = new Date(`${date}T00:00:00Z`); // Append time in UTC to avoid local timezone issues\r\n\t\treturn (\r\n\t\t\tparsedDate instanceof Date &&\r\n\t\t\t!Number.isNaN(parsedDate.getTime()) &&\r\n\t\t\tparsedDate.toISOString().startsWith(date)\r\n\t\t);\r\n\t}\r\n\r\n\tif (typeof date === \"number\") {\r\n\t\tconst parsedDate = new Date(date);\r\n\t\treturn !Number.isNaN(parsedDate.getTime());\r\n\t}\r\n\r\n\tif (date instanceof Date) {\r\n\t\treturn !Number.isNaN(date.getTime());\r\n\t}\r\n\r\n\treturn false; // If it's none of the above types, return false\r\n};\r\n\r\n/**\r\n * Parses a date and returns an object containing the day, month, year, and full year.\r\n * Accepts a string (in the format YYYY-MM-DD), a timestamp (number), or a Date object.\r\n * @param date - The birth date to parse.\r\n * @returns {{day: string, month: string, year: string, fullYear: string}} An object containing the day, month, year, and full year.\r\n */\r\nexport const parseDate = (\r\n\tdate: string | number | Date,\r\n): {\r\n\tday: string;\r\n\tmonth: string;\r\n\tyear: string;\r\n\tfullYear: string;\r\n} => {\r\n\tconst parsedDate = new Date(date instanceof Date ? date.getTime() : date);\r\n\tconst day = String(parsedDate.getUTCDate()).padStart(2, \"0\"); // Get day in UTC\r\n\tconst month = String(parsedDate.getUTCMonth() + 1).padStart(2, \"0\"); // Month is zero-based; get in UTC\r\n\tconst year = String(parsedDate.getUTCFullYear()).slice(-2); // Last 2 digits of year\r\n\tconst fullYear = String(parsedDate.getUTCFullYear()); // Full year in UTC\r\n\r\n\treturn { day, month, year, fullYear };\r\n};\r\n","import {\r\n\tcalculateVerificationDigit,\r\n\tfindFirstConsonant,\r\n\ttype Gender,\r\n\tGENDERS,\r\n\tgetPrimaryName,\r\n\tgetSpecialChar,\r\n\tisValidDate,\r\n\tnormalizeString,\r\n\tparseDate,\r\n\tremoveCompoundWords,\r\n\treplaceBadWords,\r\n\treplaceNonAlphabetic,\r\n\ttype State,\r\n\tSTATES,\r\n} from \"./utils\";\r\n\r\nexport type { State } from \"./utils\";\r\n\r\n/**\r\n * Creates a CURP (Clave Única de Registro de Población) based on the provided\r\n * personal information and birth date.\r\n * The CURP format follows specific rules regarding the arrangement of\r\n * letters and numbers based on the person's names, birth date, gender, and state.\r\n * @param {string} name The full name.\r\n * @param {string} paternalSurname The first surname (last name).\r\n * @param {Gender} gender The gender.\r\n * @param {State} state The state code.\r\n * @param {string | number | Date} birthDate The date of birth in YYYY-MM-DD format.\r\n * @param {string} [maternalSurname=\"\"] The second surname (last name).\r\n * @returns {string} The generated CURP string.\r\n * @throws {Error} Throws an error if the date of birth has an incorrect format.\r\n */\r\nexport const createCURP = (\r\n\tname: string,\r\n\tpaternalSurname: string,\r\n\tgender: Gender,\r\n\tstate: State,\r\n\tbirthDate: string | number | Date,\r\n\tmaternalSurname = \"\",\r\n): string => {\r\n\tif (!isValidDate(birthDate)) {\r\n\t\tthrow new Error(\r\n\t\t\t\"The date of birth is an invalid date or is in an invalid format.\",\r\n\t\t);\r\n\t}\r\n\r\n\tconst cName = removeCompoundWords(normalizeString(name).toUpperCase());\r\n\tconst cPaternalSurname = removeCompoundWords(\r\n\t\tnormalizeString(paternalSurname).toUpperCase(),\r\n\t);\r\n\tconst cMaternalSurname = removeCompoundWords(\r\n\t\tnormalizeString(maternalSurname).toUpperCase(),\r\n\t);\r\n\r\n\tconst letterName = getPrimaryName(cName).charAt(0);\r\n\r\n\tconst vowelPaternalSurname =\r\n\t\tcPaternalSurname\r\n\t\t\t.substring(1) // Skip the first character\r\n\t\t\t.match(/[AEIOU]/i)?.[0] || \"X\"; // Find the first vowel or return 'X' if none found\r\n\r\n\tconst letterPaternalSurname =\r\n\t\tcPaternalSurname.charAt(0) === \"Ñ\" ? \"X\" : cPaternalSurname.charAt(0);\r\n\tlet letterMaternalSurname = cMaternalSurname.charAt(0) || \"X\"; // If empty string (falsy)\r\n\tletterMaternalSurname =\r\n\t\tletterMaternalSurname === \"Ñ\" ? \"X\" : letterMaternalSurname;\r\n\r\n\tconst firstCompositionJoin = [\r\n\t\tletterPaternalSurname,\r\n\t\tvowelPaternalSurname,\r\n\t\tletterMaternalSurname,\r\n\t\tletterName,\r\n\t].join(\"\");\r\n\tconst firstComposition = replaceBadWords(\r\n\t\treplaceNonAlphabetic(firstCompositionJoin),\r\n\t);\r\n\r\n\tconst consonants = replaceNonAlphabetic(\r\n\t\t[\r\n\t\t\tfindFirstConsonant(cPaternalSurname),\r\n\t\t\tfindFirstConsonant(cMaternalSurname),\r\n\t\t\tfindFirstConsonant(getPrimaryName(cName)),\r\n\t\t].join(\"\"),\r\n\t);\r\n\r\n\tconst { day, month, year, fullYear } = parseDate(birthDate);\r\n\r\n\tconst incompleteCURP = [\r\n\t\tfirstComposition,\r\n\t\tyear,\r\n\t\tmonth,\r\n\t\tday,\r\n\t\tGENDERS[gender],\r\n\t\tSTATES[state],\r\n\t\tconsonants,\r\n\t\tgetSpecialChar(fullYear),\r\n\t].join(\"\");\r\n\treturn [incompleteCURP, calculateVerificationDigit(incompleteCURP)].join(\"\");\r\n};\r\n\r\n/**\r\n * Validates a given CURP (Clave Única de Registro de Población).\r\n * @param {string} curp The CURP string to validate.\r\n * @returns {boolean} Returns true if the CURP is valid, otherwise false.\r\n */\r\nexport const validateCURP = (curp: string): boolean => {\r\n\tconst regex =\r\n\t\t/^([A-Z][AEIOUX][A-Z]{2}\\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\\d|3[01])[HM](?:AS|B[CS]|C[CLMSH]|D[FG]|G[TR]|HG|JC|M[CNS]|N[ETL]|OC|PL|Q[TR]|S[PLR]|T[CSL]|VZ|YN|ZS)[B-DF-HJ-NP-TV-Z]{3}[A-Z\\d])(\\d)$/;\r\n\treturn regex.test(curp);\r\n};\r\n"],"mappings":";AAAO,IAAM,UAAU;AAAA,EACtB,MAAM;AAAA,EACN,QAAQ;AACT;AAIO,IAAM,SAAS;AAAA,EACrB,gBAAgB;AAAA,EAChB,iBAAiB;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