Calculate the Mexican RFC as specified by the SAT (Servicio de Administración Tributaria) for Personas Físicas

Overview

About The Project

This project calculates a "Persona Física"'s RFC based on SAT's specifications including homonymy and verification digit.

Built With

(back to top)

Installation

Yarn:

yarn add calculate-rfc

NPM:

npm install calculate-rfc

(back to top)

Usage

Import:

import { calculateMexicanRFC } from 'calculate-rfc'

Require:

const { calculateMexicanRFC } = require('calculate-rfc')

Usage:

const rfc = calculateMexicanRFC({
  name: 'Guillermo',
  patronymic: 'Del Toro', // name derived from a name of a father or ancestor
  matronymic: 'Gómez', // name derived from a name of a mother or ancestor
  year: '64',
  month: '10',
  day: '09',
})

console.log(rfc) // TOGG641009MGA

Note: Names in Mexico usually have two last names ordered as name(s) patronymic matronymic, however, names with a single last name are also valid. In order to get an accurate result, the full name should match the one registered with SAT.

(back to top)

Acknowledgments

There is no guarantee that the calculated RFC will match the real RFC as only the SAT can assign an RFC to ensure homonymy and verification code uniqueness, therefore, be sure to validate the output with your users.

The RFC specifications can be downloaded from "Plataforma Nacional de Transparencia" with the folio: 0610100135506

This README's structure is based off Best-README-Template

(back to top)

Roadmap

  • Add tests for all SAT rules
  • Validate input

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Thanks!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
    1. Install dev dependencies with yarn
    2. Run test server with yarn test.
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

You might also like...

A small CLI to sort any specified json files alphabetically

This is a small CLI to sort any specified json files alphabetically. This was created to sort localization files, but maybe you will find another use case.

Mar 20, 2022

CLI utility that parses argv, loads your specified file, and passes the parsed argv into your file's exported function. Supports ESM/TypeScript/etc out of the box.

cleffa CLI tool that: Parses argv into an object (of command-line flags) and an array of positional arguments Loads a function from the specified file

Mar 6, 2022

An Obsidian plugin to add (prepend or append) specified content to a note (existing or new) without opening another pane.

An Obsidian plugin to add (prepend or append) specified content to a note (existing or new) without opening another pane.

Obsidian Note Content Pusher An Obsidian plugin to add (prepend or append) specified content to a note (existing or new) without opening another pane.

Nov 6, 2022

Tries to execute sync/async function, returns a specified default value if the function throws

good-try Tries to execute sync/async function, returns a specified default value if the function throws. Why Why not nice-try with it's 70+ million do

Dec 8, 2022

CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files.

convert-to-oklch CLI tool that converts rgb(), rgba(), hex, hsl() and hsla() colors to oklch() in specified CSS files. npx convert-to-oklch ./src/**/*

Dec 20, 2022

Debut plugin that provides additional candles of specified tickers to strategy.

debut-plugin-candles A plugin for Debut platform that provides additional candles of specified tickers to strategy. Install @debut/community-core shou

Dec 15, 2022

⚡️The Fullstack React Framework — built on Next.js

⚡️The Fullstack React Framework — built on Next.js

The Fullstack React Framework "Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails Read the Documentation “Zero-API” data layer lets y

Jan 4, 2023

Chatbot encargado de brindar información a los alumnos de las preparatorias universidad autónoma de Zacatecas o a las personas interesadas en ellas

Chatbot encargado de brindar información a los alumnos de las preparatorias universidad autónoma de Zacatecas o a las personas interesadas en ellas

Chatbot encargado de brindar información a los alumnos de las preparatorias universidad autónoma de Zacatecas o a las personas interesadas en ellas, en cual se implementará el análisis de sentimientos para la detección de algún indicio de problema de salud mental esto identificando mensajes positivos y negativos, al igual que los tipos de sentimientos como tristeza, felicidad, enfado, etc.

Dec 19, 2021

A simple library to validate Mexican CURPs (Personal ID)

Validate CURP A simple and lightweight library to validate Mexican CURPs (Personal ID). Install NodeJS Use NPM: $ npm install --save validate-curp Or

Nov 24, 2022

Vamos a realizar un juego muy sencillo en TypeScript, posteriormente lo vamos a desplegar en Microsoft Azure con Servicio de Azure Static Web Apps.

Vamos a realizar un juego muy sencillo en TypeScript, posteriormente lo vamos a desplegar en Microsoft Azure con Servicio de Azure Static Web Apps.

Taller TypeScript Descripción Vamos a realizar un juego muy sencillo en TypeScript, posteriormente lo vamos a desplegar en Microsoft Azure con Servici

Oct 10, 2022

Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

May 18, 2022

Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

May 3, 2022

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

JavaScript OAuth 1.0a signature generator (RFC 5849) for node and the browser

OAuth 1.0a signature generator for node and the browser Compliant with RFC 5843 + Errata ID 2550 and community spec Installation Install with npm: npm

Dec 16, 2022

Wrap native HTTP requests with RFC compliant cache support

cacheable-request Wrap native HTTP requests with RFC compliant cache support RFC 7234 compliant HTTP caching for native Node.js HTTP/HTTPS requests. C

Dec 20, 2022

A WebSocket Implementation for Node.JS (Draft -08 through the final RFC 6455)

WebSocket Client & Server Implementation for Node Overview This is a (mostly) pure JavaScript implementation of the WebSocket protocol versions 8 and

Dec 30, 2022

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Jan 14, 2022

A Node.js library to calculate Uniswap V3 ratios (prices) from token pairs.

UniV3Prices A Node.js library to calculate Uniswap V3 ratios (prices) and liquidity (reserves). Features This library will allow you to: Calculate pri

Dec 29, 2022

Calculate the price range for property advertised on Domain and Real Estate.

Calculate the price range for property advertised on Domain and Real Estate.

Property Seeker Calculate the price range for property advertised on Domain and Real Estate. Install Chrome Firefox Edge Privacy All searches are perf

Dec 27, 2022
Owner
null
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

Use plain functions as modifiers. Polyfill for RFC: 757 | Default Modifier Manager

null 7 Jan 14, 2022
A Node.js library to calculate Uniswap V3 ratios (prices) from token pairs.

UniV3Prices A Node.js library to calculate Uniswap V3 ratios (prices) and liquidity (reserves). Features This library will allow you to: Calculate pri

Thanos Polychronakis 121 Dec 29, 2022
Calculate the price range for property advertised on Domain and Real Estate.

Property Seeker Calculate the price range for property advertised on Domain and Real Estate. Install Chrome Firefox Edge Privacy All searches are perf

null 42 Dec 27, 2022
A concise collection of classes for PHP, Python, JavaScript and Ruby to calculate great circle distance, bearing, and destination from geographic coordinates

GreatCircle A set of three functions, useful in geographical calculations of different sorts. Available for PHP, Python, Javascript and Ruby. Live dem

null 72 Sep 30, 2022
Convert and Calculate by RPN for typescript.

Coaca.ts: Convert and Calculate by RPN for typescript 注意点 まずそもそも、typescriptはサーバサイドで使用されるべき言語です。一応typescript4.5以降の機能を用いていますが、typescriptの本来の使い方を超越してます。ご

赤紫 2 Aug 24, 2022
A tool to calculate discount available on SGB (Sovereign Gold Bonds) compared to current market price on NSE

A tool to calculate discount available on SGB (Sovereign Gold Bonds) compared to current market price on NSE

Amit Wani 9 Nov 20, 2022
An interpreter for College Board's specified pseudocode for the AP Computer Science Principles Exam.

College Board Pseudocode Interpreter A playground for this interpreter is up on my website. This project is a mostly-functioning interpreter for Colle

Daniel 7 Nov 16, 2022