{"id":22731016,"url":"https://github.com/vizeat/censorify-it","last_synced_at":"2025-04-14T00:26:57.172Z","repository":{"id":48449717,"uuid":"200238940","full_name":"vizeat/censorify-it","owner":"vizeat","description":"Censor unwanted URLs, emails and telephone numbers to prevent spam","archived":false,"fork":false,"pushed_at":"2021-07-25T22:15:55.000Z","size":463,"stargazers_count":7,"open_issues_count":8,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-27T14:47:55.827Z","etag":null,"topics":["spam","spam-detection","spam-filtering","spam-protection"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/censorify-it","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vizeat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-02T13:25:21.000Z","updated_at":"2023-08-25T12:48:10.000Z","dependencies_parsed_at":"2022-08-29T14:50:39.810Z","dependency_job_id":null,"html_url":"https://github.com/vizeat/censorify-it","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vizeat%2Fcensorify-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vizeat%2Fcensorify-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vizeat%2Fcensorify-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vizeat%2Fcensorify-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vizeat","download_url":"https://codeload.github.com/vizeat/censorify-it/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495286,"owners_count":21113603,"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":["spam","spam-detection","spam-filtering","spam-protection"],"created_at":"2024-12-10T19:19:00.916Z","updated_at":"2025-04-14T00:26:57.148Z","avatar_url":"https://github.com/vizeat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# censorify-it\n\n[![codecov](https://codecov.io/gh/vizeat/censorify-it/branch/master/graph/badge.svg)](https://codecov.io/gh/vizeat/censorify-it)\n\nCensor unwanted URLs, emails and telephone numbers to prevent spam\n\nAnnoyed by spammers \u0026 scammers orchestrating fishing attacks with links, phone numbers or email address within your app? CensorifyIt is the answer!\n\nBuilt as an extension of [LinkifyIt](https://github.com/markdown-it/linkify-it)\n\n## Install\n\n```\nyarn add censorify-it\n```\n\n## Usage\n\n```js\nimport CensorifyIt from 'censorify-it'\n\nconst censorify = new CensorifyIt()\n\nconsole.log(censorify.process('Hello, here is https://alink.to/a-website can you find it?'))\n// 'Hello, here is ************************** can you find it?'\nconsole.log(censorify.process('My phone number is +1 123 456 7890'))\n// 'My phone number is ***************'\n\nconsole.log(censorify.match('Site github.com!'))\n// [\n//   Match {\n//     schema: '',\n//     index: 5,\n//     lastIndex: 15,\n//     raw: 'github.com',\n//     url: 'http://github.com',\n//     text: '**********'\n//   }\n// ]\n\nconsole.log(censorify.match('My phone number is 01 01 01 01 01'))\n// [\n//   Match {\n//     schema: '0',\n//     index: 19,\n//     lastIndex: 33,\n//     raw: '01 01 01 01 01',\n//     url: '01 01 01 01 01',\n//     text: '**************'\n//   }\n// ]\n```\n\nTo change the replacement string:\n\n```js\nconst censorify = new CensorifyIt()\ncensorify.set({ replacementText: 'REMOVED' })\n\nconsole.log(censorify.match('My phone number is 01 01 01 01 01'))\n// [\n//   Match {\n//     schema: '0',\n//     index: 19,\n//     lastIndex: 33,\n//     raw: '01 01 01 01 01',\n//     url: '01 01 01 01 01',\n//     text: 'REMOVED'\n//   }\n// ]\n```\n\nAccepts an exceptions array of regex or function\nregex are executed against the raw text that was matched\nfunctions takes the full match as parameters\n\n```js\nconst censorify = new CensorifyIt()\n\nconst mysiteRegex = new RegExp(/mysite.com/g)\nconst mySophisticatedException = match =\u003e match.url === 'http://example.com'\ncensorify.set({ exceptions: [mysiteRegex, mySophisticatedException] })\n\nconsole.log(censorify.match('Check out github.com or mysite.com or even example.com'))\n// [\n//   Match {\n//     schema: '',\n//     index: 10,\n//     lastIndex: 20,\n//     raw: 'github.com',\n//     url: 'http://github.com',\n//     text: '**********'\n//   },\n//   Match {\n//     schema: '',\n//     index: 24,\n//     lastIndex: 34,\n//     raw: 'mysite.com',\n//     url: 'http://mysite.com',\n//     text: 'http://mysite.com'\n//   },\n//   Match {\n//     schema: '',\n//     index: 43,\n//     lastIndex: 54,\n//     raw: 'example.com',\n//     url: 'http://example.com',\n//     text: 'http://example.com'\n//   }\n// ]\n```\n\nAll the other settings and additions as defined by [LinkifyIt](https://github.com/markdown-it/linkify-it/blob/master/README.md#api) also apply.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvizeat%2Fcensorify-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvizeat%2Fcensorify-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvizeat%2Fcensorify-it/lists"}