Skip to content

cpf-gen v3 #28

@juliolmuller

Description

@juliolmuller

Version 3+ will be structured similarly yo the PHP and Python version of the packages:

  • The logic to calculate check digits should now come from package cnpj-cd.
  • Main component should be object-oriented, so a class should wrap the logic of generating CPF.
  • Create a class to manage formatter options and apply default values when necessary.
    • Options are meant to be changed by using properties assignment, not getters and setters functions anymore.
  • An exception should be thrown if prefix contain repeated digits (e.g. 111.111.111-*, 222.222.222-*, 333.333.333-* and so on)
  • Create custom errors for ALL exepcted errors.
  • Validate and parse arguments, when possible, and throw a custom TypeError.
  • The following components are now expeced to be exported from the final bundle:
    • CnpjGenerator (base class)
    • CnpjGeneratorOptions
    • cnpjGen (should be a bound function of the generate method of a default instance).
    • CnpjGeneratorTypeError (abstract)
    • CnpjGeneratorOptionTypeError
    • CnpjGeneratorException (abstract)
    • CnpjGeneratorOptionPrefixLengthException
    • CnpjGeneratorOptionPrefixInvalidException
  • Update unit tests
  • Update documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions