{"id":21842161,"url":"https://github.com/fpg1503/cpf-cnpj-validator","last_synced_at":"2025-04-14T11:53:31.458Z","repository":{"id":56905013,"uuid":"77303480","full_name":"fpg1503/CPF-CNPJ-Validator","owner":"fpg1503","description":"🆔 Swifty CPF and CNPJ Validator with customizable rules","archived":false,"fork":false,"pushed_at":"2018-04-05T14:49:19.000Z","size":52,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T18:54:42.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fpg1503.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-24T23:24:30.000Z","updated_at":"2025-02-21T22:54:41.000Z","dependencies_parsed_at":"2022-08-21T02:50:28.705Z","dependency_job_id":null,"html_url":"https://github.com/fpg1503/CPF-CNPJ-Validator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCPF-CNPJ-Validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCPF-CNPJ-Validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCPF-CNPJ-Validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fpg1503%2FCPF-CNPJ-Validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fpg1503","download_url":"https://codeload.github.com/fpg1503/CPF-CNPJ-Validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877982,"owners_count":21176241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T22:10:47.400Z","updated_at":"2025-04-14T11:53:31.425Z","avatar_url":"https://github.com/fpg1503.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CPF-CNPJ-Validator\n\n[![CI Status](http://img.shields.io/travis/fpg1503/CPF-CNPJ-Validator.svg?style=flat)](https://travis-ci.org/fpg1503/CPF-CNPJ-Validator)\n[![Version](https://img.shields.io/cocoapods/v/CPF-CNPJ-Validator.svg?style=flat)](https://cocoapods.org/pods/CPF-CNPJ-Validator)\n[![License](https://img.shields.io/cocoapods/l/CPF-CNPJ-Validator.svg?style=flat)](https://cocoapods.org/pods/CPF-CNPJ-Validator)\n[![Platform](https://img.shields.io/cocoapods/p/CPF-CNPJ-Validator.svg?style=flat)](https://cocoapods.org/pods/CPF-CNPJ-Validator)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nA Swift library to validate CPF and CNPJ. Automatically strips formatting, covers valid numbers, wrong length, number sequences, and common fake numbers. Options can be passed to allow invalid number sequences, that's useful for testing.\n\n## Usage\n\nYou can use two types of validators: `StatusValidator` (if you're interested in what's wrong) and `BooleanValidator` (if you only care if a given number is valid or not).\n\n### `BooleanValidator`\n\n```swift\nlet success = BooleanValidator().validate(cpf: \"12345678909\")\n```\n\n### `StatusValidator`\n\n```swift\nlet cpf = \"1234567890912345678909\"\nlet status = validator.validate(cpf: cpf)\n//Status is .wrongLength\n```\n\n### Validation Options\n\nYou can also pass options to the validate method. The options available are:\n\n- Add Leading Zeros\n- Ignore Remaining Characters\n- Interpret Only Numbers\n- Allow Repeated Patterns\n- Allow Common Numbers\n\nBy default no options are given\n\n### Validation Statuses\n\nThe possible validation statuses are:\n\n- Valid\n- Wrong Length (i.e. `111`)\n- Repeated Pattern (i.e. `111.111.111-11`)\n- Common Number (i.e. `123.456.789-09`)\n- Invalid (invalid verification digits)\n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation\n\nFor Swift 4.0+ use v1.0\n\n### CocoaPods\n\n[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nTo integrate CPF-CNPJ-Validator into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\nuse_frameworks!\n\npod 'CPF-CNPJ-Validator'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate CPF-CNPJ-Validator into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"fpg1503/CPF-CNPJ-Validator\" ~\u003e 1.0\n```\n\nRun `carthage update` to build the framework and drag the built `CPF-CNPJ-Validator.framework` into your Xcode project.\n\n\n## Author\n\nFrancesco Perrotti-Garcia ([@fpg1503](https://github.com/fpg1503))\n\n### Contributing\n\nAll contributions are welcome. Feel free to open Issues and PRs. In case of doubts read our [CONTRIBUTING.md](https://github.com/fpg1503/CPF-CNPJ-Validator/blob/master/CONTRIBUTING.md), open an issue or tweet me [@fpg1503](https://twitter.com/fpg1503).\n\n## License\n\nCPF-CNPJ-Validator is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpg1503%2Fcpf-cnpj-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffpg1503%2Fcpf-cnpj-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffpg1503%2Fcpf-cnpj-validator/lists"}