{"id":17458116,"url":"https://github.com/pocesar/js-diacritic-regex","last_synced_at":"2025-04-14T17:11:46.547Z","repository":{"id":3870376,"uuid":"51181809","full_name":"pocesar/js-diacritic-regex","owner":"pocesar","description":"Creates the inverse of transliterated string to a regex. What? Basically, diacritic insensitiveness","archived":false,"fork":false,"pushed_at":"2024-07-11T17:18:02.000Z","size":96,"stargazers_count":27,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T17:11:39.793Z","etag":null,"topics":["accent","accents","database","diacritics","insensitive","insensitiveness","regex","regex-match","regexp","regexp-search","transliterate","transliteration"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/pocesar.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-05T23:59:15.000Z","updated_at":"2024-10-01T09:07:43.000Z","dependencies_parsed_at":"2024-10-28T09:17:55.962Z","dependency_job_id":"dee3ecf9-b25a-4cc9-99f9-f11a7995256a","html_url":"https://github.com/pocesar/js-diacritic-regex","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":0.55,"last_synced_commit":"d1e237718c148da703f54175a023ca1bf3cee1b4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocesar%2Fjs-diacritic-regex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocesar%2Fjs-diacritic-regex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocesar%2Fjs-diacritic-regex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pocesar%2Fjs-diacritic-regex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pocesar","download_url":"https://codeload.github.com/pocesar/js-diacritic-regex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923765,"owners_count":21183953,"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":["accent","accents","database","diacritics","insensitive","insensitiveness","regex","regex-match","regexp","regexp-search","transliterate","transliteration"],"created_at":"2024-10-18T03:54:44.772Z","updated_at":"2025-04-14T17:11:46.517Z","avatar_url":"https://github.com/pocesar.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pocesar/js-diacritic-regex.svg?branch=master)](https://travis-ci.org/pocesar/js-diacritic-regex)\n[![Coverage Status](https://coveralls.io/repos/github/pocesar/js-diacritic-regex/badge.svg?branch=master)](https://coveralls.io/github/pocesar/js-diacritic-regex?branch=master)\n\n[![NPM](https://nodei.co/npm/diacritic-regex.png)](https://nodei.co/npm/diacritic-regex/)\n\n# Diacritic regex\n\nCreates the inverse of transliterated string to a regex. What? Basically, a regex that is diacritic insensitive\n\n## Why?\n\nSometimes the user will search for **blasé**, but your database is dumb and doesn't understand collations and diacritic insensitiveness, but it can compare stuff using regex, so there ya go.\n\n## How?\n\nSuppose you have the word **résumé** but written improperly in the database as **resume**. The user is clever, and types it correctly into the search box. Gets nothing. How to search for all the weird cases people mistype stuff when comes to accents?\n\n```es6\nimport { toRegex, toString } from 'diacritic-regex';\n\ntoRegex()('résumé') // =\u003e /r[eEÉéÈèÊêëË]s[úùÚÙüÜuU]m[eEÉéÈèÊêëË]/i;\ntoRegex({flags: 'mu'})('résumé') // =\u003e /r[eEÉéÈèÊêëË]s[úùÚÙüÜuU]m[eEÉéÈèÊêëË]/mu;\ntoRegex({\n  flags: '',\n  mappings: {\n    'e': 'eéÉ'\n  }\n})('résumé') // =\u003e /r[eéÉ]s[úùÚÙüÜuU]m[eéÉ]/;\n\ntoString({\n    mappings: {\n        '*': ['\\\\S+'] // literals, won't try to wrap in []'s,\n        'u': ['u']\n    }\n})('résumé*') // =\u003e 'r[eEÉéÈèÊêëË]sum[eEÉéÈèÊêëË]\\S+'\n```\n\nIf you want to change the mappings for all instances:\n\n```ts\nimport { mappings } from 'diacritic-regex'\n\nmappings['*'] = ['[\\\\S\\\\s]+']\n```\n\n## Caveats\n\nBe aware of [RegExp.prototype.exec](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec) with `g` flag being stateful\n\nThe `i` flag is appended to the RegExp flags if you don't pass any flags to `toRegex`\n\n## Compatibility\n\nWork in node and the browser, but needs polyfills for `Array.reduce`, `Array.map` and `Object.keys` depending on how old your target browser is\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocesar%2Fjs-diacritic-regex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpocesar%2Fjs-diacritic-regex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpocesar%2Fjs-diacritic-regex/lists"}