JSPM

@tianjos/cpf

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q68171F
  • License MIT

Object Oriented CPF validator implementation

Package Exports

  • @tianjos/cpf

Readme

Installation

npm i @tianjos/cpf

Usage

import { CPF } from '@tianjos/cpf'

const cpf = new CPF("111.444.777-35")

Motivation

This package is the result of my study of the book "Elegant Objects vol 1. By Yegor Bugayenko"

I tried to implement a version of the CPF (brazilian id) validator as close as possible to the object-oriented programming paradigm.

Implementation

I used the availability algorithm by Macoratti as a basis for implementation. "Algoritmo de Validação de CPF". Only addition that I made was check equal numbers