{"id":20850603,"url":"https://github.com/multiformats/js-multiaddr-matcher","last_synced_at":"2025-05-12T04:31:33.897Z","repository":{"id":185833295,"uuid":"674194410","full_name":"multiformats/js-multiaddr-matcher","owner":"multiformats","description":"Match different multiaddr formats","archived":false,"fork":false,"pushed_at":"2025-03-28T13:12:52.000Z","size":394,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-08T18:51:49.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multiformats.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-03T11:03:10.000Z","updated_at":"2025-03-28T13:06:26.000Z","dependencies_parsed_at":"2024-03-21T15:59:30.445Z","dependency_job_id":"945d8e0c-c0a7-42e7-abab-b2067fe2b742","html_url":"https://github.com/multiformats/js-multiaddr-matcher","commit_stats":null,"previous_names":["multiformats/js-multiaddr-matcher"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr-matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr-matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr-matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multiformats%2Fjs-multiaddr-matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multiformats","download_url":"https://codeload.github.com/multiformats/js-multiaddr-matcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253324226,"owners_count":21890847,"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-18T03:10:31.713Z","updated_at":"2025-05-12T04:31:33.510Z","avatar_url":"https://github.com/multiformats.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @multiformats/multiaddr-matcher\n\n[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)\n[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiaddr-matcher.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiaddr-matcher)\n[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr-matcher/js-test-and-release.yml?branch=main\\\u0026style=flat-square)](https://github.com/multiformats/js-multiaddr-matcher/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n\u003e Match different multiaddr formats\n\n# About\n\n\u003c!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n--\u003e\n\nThis module exports various matchers that can be used to infer the type of a\npassed multiaddr.\n\n## Example\n\n```ts\nimport { multiaddr } from '@multiformats/multiaddr'\nimport { DNS } from '@multiformats/multiaddr-matcher'\n\nconst ma = multiaddr('/dnsaddr/example.org')\n\nDNS.matches(ma) // true - this is a multiaddr with a DNS address at the start\n```\n\n## Example\n\nThe default matching behaviour ignores any subsequent tuples in the multiaddr.\nIf you want stricter matching you can use `.exactMatch`:\n\n```ts\nimport { multiaddr } from '@multiformats/multiaddr'\nimport { DNS, Circuit } from '@multiformats/multiaddr-matcher'\n\nconst ma = multiaddr('/dnsaddr/example.org/p2p/QmFoo/p2p-circuit/p2p/QmBar')\n\nDNS.exactMatch(ma) // false - this address has extra tuples after the DNS component\nCircuit.matches(ma) // true\nCircuit.exactMatch(ma) // true - the extra tuples are circuit relay related\n```\n\n# Install\n\n```console\n$ npm i @multiformats/multiaddr-matcher\n```\n\n## Browser `\u003cscript\u003e` tag\n\nLoading this module through a script tag will make its exports available as `MultiformatsMultiaddrMatcher` in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/@multiformats/multiaddr-matcher/dist/index.min.js\"\u003e\u003c/script\u003e\n```\n\n# API Docs\n\n- \u003chttps://multiformats.github.io/js-multiaddr-matcher\u003e\n\n# License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](https://github.com/multiformats/js-multiaddr-matcher/LICENSE-APACHE) / \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT ([LICENSE-MIT](https://github.com/multiformats/js-multiaddr-matcher/LICENSE-MIT) / \u003chttp://opensource.org/licenses/MIT\u003e)\n\n# Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-multiaddr-matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultiformats%2Fjs-multiaddr-matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultiformats%2Fjs-multiaddr-matcher/lists"}