{"id":31142946,"url":"https://github.com/lacussolutions/cnpj-utils-js","last_synced_at":"2026-02-16T04:02:20.095Z","repository":{"id":57126120,"uuid":"374857875","full_name":"LacusSolutions/cnpj-utils-js","owner":"LacusSolutions","description":"Straight forward JavaScript package to handle CNPJ data (Brazilian employer ID).","archived":true,"fork":false,"pushed_at":"2025-08-19T04:43:14.000Z","size":992,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-18T13:48:38.629Z","etag":null,"topics":["br","bun","cnpj","format","formatter","generate","generator","javascript","node","npm","typescript","validate","validator"],"latest_commit_sha":null,"homepage":"https://cnpj-utils.vercel.app/","language":"JavaScript","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/LacusSolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-08T02:32:07.000Z","updated_at":"2025-08-27T19:45:03.000Z","dependencies_parsed_at":"2025-04-19T06:34:16.854Z","dependency_job_id":"aad71b1b-37b4-410b-80c7-872c0a7ebaba","html_url":"https://github.com/LacusSolutions/cnpj-utils-js","commit_stats":null,"previous_names":["lacussolutions/cnpj-utils-js","juliolmuller/cnpj-utils-js"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/LacusSolutions/cnpj-utils-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacusSolutions%2Fcnpj-utils-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacusSolutions%2Fcnpj-utils-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacusSolutions%2Fcnpj-utils-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacusSolutions%2Fcnpj-utils-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LacusSolutions","download_url":"https://codeload.github.com/LacusSolutions/cnpj-utils-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LacusSolutions%2Fcnpj-utils-js/sbom","scorecard":{"id":542261,"data":{"date":"2025-08-11","repo":{"name":"github.com/juliolmuller/cnpj-utils-js","commit":"67ca1fa26bc63ca79d1864a6a99ebf93f832a83b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/release.yml:25","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:49: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:64: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/release.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/release.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/juliolmuller/cnpj-utils-js/release.yml/main?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   6 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T08:30:23.871Z","repository_id":57126120,"created_at":"2025-08-20T08:30:23.871Z","updated_at":"2025-08-20T08:30:23.871Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29499804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T03:57:51.541Z","status":"ssl_error","status_checked_at":"2026-02-16T03:55:59.854Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["br","bun","cnpj","format","formatter","generate","generator","javascript","node","npm","typescript","validate","validator"],"created_at":"2025-09-18T13:17:29.984Z","updated_at":"2026-02-16T04:02:19.816Z","avatar_url":"https://github.com/LacusSolutions.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cnpj-utils for JavaScript\n\n![NPM Latest Version](https://img.shields.io/npm/v/cnpj-utils)\n![Bundle Size](https://img.shields.io/bundlephobia/min/cnpj-utils?label=bundle%20size)\n![Downloads Count](https://img.shields.io/npm/dm/cnpj-utils.svg)\n![Test Status](https://img.shields.io/github/actions/workflow/status/juliolmuller/cnpj-utils-js/ci.yml?label=ci/cd)\n![Last Update Date](https://img.shields.io/github/last-commit/juliolmuller/cnpj-utils-js)\n![Project License](https://img.shields.io/github/license/juliolmuller/cnpj-utils-js)\n\nToolkit to handle the main operations with CNPJ data (Brazilian corporate ID): validation, formatting and generation of valid character sequences.\n\n## Browser Support\n\n![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Edge](https://raw.github.com/alrra/browser-logos/master/src/edge/edge_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) |\n--- | --- | --- | --- | --- | --- |\nLatest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ |\n\n## Installation\n\n```bash\n# using NPM\n$ npm install --save cnpj-utils\n\n# using Bun\n$ bun add cnpj-utils\n```\n\n## Import\n\n```js\n// Common JS syntax:\nconst cnpjUtils = require('cnpj-utils')\n\n// ES Module syntax:\nimport cnpjUtils from 'cnpj-utils'\n// or get the specific function with ES tree-shaking:\nimport { isValid, generate, format } from 'cnpj-utils'\n```\n\nor import it through your HTML file, using CDN:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/cnpj-utils@latest/dist/cnpj-utils.min.js\"\u003e\u003c/script\u003e\n```\n\n## API\n\n`cnpj-utils` is only a wrapper to the libraries maintained by **LacusSoft**, [`cnpj-fmt`](https://www.npmjs.com/package/@lacussoft/cnpj-fmt), [`cnpj-gen`](https://www.npmjs.com/package/@lacussoft/cnpj-gen) and [`cnpj-val`](https://www.npmjs.com/package/@lacussoft/cnpj-val), so you can refer directly to their specific documentation. Anyway, the API is detailed hereby with examples.\n\n### `cnpjUtils.format(string[, options])`\n\n**returns** `string`\n\nThe `format` method expects a string as its first parameter.\n\nIf the input does not contain 14 digits (it does not need to be a valid CNPJ, but it MUST be 14-digits long) an `onFail` callback is invoked. By default, a copy of the input is returned as a fallback, but this callback and other customizations may be defined in the second parameter.\n\n```js\nconst cnpj = '03603568000195'\n\ncnpjUtils.format(cnpj)     // returns '03.603.568/0001-95'\n\ncnpjUtils.format(cnpj, {   // returns '03.603.***/****-**'\n  hidden: true\n})\n\ncnpjUtils.format(cnpj, {   // returns '03603568|0001_95'\n  delimiters: {\n    dot: '',\n    slash: '|',\n    dash: '_'\n  }\n})\n```\n\nHere are the available default configurations that can be overwritten by the `options` parameter:\n\n```js\ncnpjUtils.format(cnpj, {\n  delimiters: {\n    dot: '.',       // string to replace the dot characters\n    slash: '/',     // string to replace the slash character\n    dash: '-'       // string to replace the dash character\n  },\n  escape: false,    // boolean to define if the result should be HTML escaped\n  hidden: false,    // boolean to define if digits should be hidden\n  hiddenKey: '*',   // string to replace hidden digits\n  hiddenRange: {\n    start: 5,       // starting index of the numeric sequence to be hidden (min 0)\n    end: 13         // ending index of the numeric sequence to be hidden (max 13)\n  },\n  onFail(value) {   // fallback function to be invoked in case a non-14-digits is passed\n    return value\n  }\n})\n```\n\n### `cnpjUtils.generate([options])`\n\n**returns** `string`\n\nIf you need to generate valid CNPJs, the `generate` method makes this task easy and safe. Invoke it without parameters to obtain a 14‑digit string. You can also provide an `options` object to configure its output, like flagging it to format or to complete a digits string with a valid CNPJ sequence:\n\n```js\nlet cnpj = cnpjUtils.generate()   // returns '65453043000178'\n\ncnpj = cnpjUtils.generate({       // returns '73.008.535/0005-06'\n  format: true\n})\n\ncnpj = cnpjUtils.generate({       // returns '45623767000296'\n  prefix: '45623767'\n})\n\ncnpj = cnpjUtils.generate({       // returns '45.623.767/0002-96'\n  prefix: '456237670002',\n  format: true\n})\n```\n\nThe default configurations are:\n\n```js\ncnpjUtils.generate({\n  format: false,    // indicates if output should be formatted\n  prefix: ''        // if you have a CNPJ initials and want to complete it with valid\n})                  //   digits. The string provided must contain between 1 and 12 digits!\n```\n\nKeep in mind that, for the `prefix` option, it must be a **string** containing up to 12 digits.\n\n### `cnpjUtils.isValid(string)`\n\n**returns** `boolean`\n\nThe `isValid` method receives a string as its single parameter, evaluates it and returns `true` or `false` as output. This parameter may contain any character like letters, symbols, punctuation or white spaces, but it will immediately return `false` in case the expected 14 digits are not found to be deeply evaluated.\n\n\n```js\ncnpjUtils.isValid('98765432000198')      // returns 'true'\n\ncnpjUtils.isValid('98.765.432/0001-98')  // returns 'true'\n\ncnpjUtils.isValid('98765432000199')      // returns 'false'\n                                ^^\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacussolutions%2Fcnpj-utils-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flacussolutions%2Fcnpj-utils-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flacussolutions%2Fcnpj-utils-js/lists"}