{"id":17919806,"url":"https://github.com/nexucis/fuzzy","last_synced_at":"2025-09-24T05:31:51.111Z","repository":{"id":40002664,"uuid":"287041281","full_name":"Nexucis/fuzzy","owner":"Nexucis","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-16T13:29:51.000Z","size":317,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T06:10:55.673Z","etag":null,"topics":["filter","fuzzy","search","typescript"],"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/Nexucis.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}},"created_at":"2020-08-12T14:52:13.000Z","updated_at":"2024-11-16T11:40:02.000Z","dependencies_parsed_at":"2022-07-22T22:49:44.920Z","dependency_job_id":null,"html_url":"https://github.com/Nexucis/fuzzy","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nexucis%2Ffuzzy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nexucis%2Ffuzzy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nexucis%2Ffuzzy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nexucis%2Ffuzzy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nexucis","download_url":"https://codeload.github.com/Nexucis/fuzzy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234044341,"owners_count":18770784,"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":["filter","fuzzy","search","typescript"],"created_at":"2024-10-28T20:19:15.241Z","updated_at":"2025-09-24T05:31:45.767Z","avatar_url":"https://github.com/Nexucis.png","language":"TypeScript","readme":"Fuzzy\n=====\n[![CircleCI](https://circleci.com/gh/Nexucis/fuzzy.svg?style=shield)](https://circleci.com/gh/Nexucis/fuzzy) [![codecov](https://codecov.io/gh/Nexucis/fuzzy/branch/master/graph/badge.svg)](https://codecov.io/gh/Nexucis/fuzzy) \n[![NPM version](https://img.shields.io/npm/v/@nexucis/fuzzy.svg)](https://www.npmjs.com/package/@nexucis/fuzzy) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\nThis lib provides a fuzzy search. It's inspired from the work of [Matt York](https://github.com/mattyork) on the repository [fuzzy](https://github.com/mattyork/fuzzy)\n\n## Installation\n\n```bash\nnpm install @nexucis/fuzzy\n```\n\n## Getting started\n\n1. Filter a simple list of string\n\n```typescript\nimport Fuzzy from '@nexucis/fuzzy'\n\nconst fuz = new Fuzzy()\nconst list = ['lion', 'goat', 'mouse', 'dragon']\n\nconsole.log(fuz.filter('li', list))\n// [\n//   {rendered: 'lion', index: 0, score: 4, original: 'lion'},\n// ]\n//\n```\n\n2. Wrap matching characters in each string for highlighting\n\n```typescript\nimport Fuzzy from '@nexucis/fuzzy'\n\nconst fuz = new Fuzzy({pre:'\u003cb\u003e', post:'\u003c/b\u003e'})\nconst list = ['lion', 'goat', 'mouse', 'dragon']\n\nconsole.log(fuz.filter('li', list))\n// [\n//   {rendered: '\u003cb\u003eli\u003c/b\u003eon', index: 0, score: 4, original: 'lion'},\n// ]\n//\n```\n\n3. Include the list of indices of the matched characters to make your own highlight\n\n```typescript\nimport Fuzzy from '@nexucis/fuzzy'\n\nconst fuz = new Fuzzy({includeMatches: true})\nconst list = ['lion', 'goat', 'mouse', 'dragon']\n\nconsole.log(fuz.filter('li', list))\n// [\n//   {rendered: 'lion', index: 0, score: 4, original: 'lion', intervales:[{from:0, to:2}]},\n// ]\n//\n```\n\n4. Override locally the global configuration\n\n```typescript\nimport Fuzzy from '@nexucis/fuzzy'\n\nconst fuz = new Fuzzy({includeMatches: true})\nconst list = ['lion', 'goat', 'mouse', 'dragon']\n\nconsole.log(fuz.filter('li', list), {includeMatches: false})\n// [\n//   {rendered: 'lion', index: 0, score: 4, original: 'lion'},\n// ]\n//\n```\n\n## Available Options\n\n**Note**: each option can be passed to the constructor or/and in each method exposed. \nThe options passed in the method take precedence over the one passed in the contructor.\n\n### caseSensitive\n\n* **Type**: `boolean`\n* **Default**: `false`\n\nIndicates whether comparisons should be case-sensitive.\n\n### excludedChars\n\n* **Type**: `array of string`\n* **Default**: `[]`\n\nList of characters that should be ignored in the pattern or in the word used for matching\n\n### includeMatches\n\n* **Type**: `boolean`\n* **Default**: `false`\n\nWhether the matches should be included in the result. When true, each record in the result set will include the indices of the matched characters. \nThese can consequently be used for highlighting purposes.\n\n### shouldSort\n\n* **Type**: `boolean`\n* **Default**: `false`\n\nWhether the result should be sorted\n\n### shouldRender\n\n* **Type**: `boolean`\n* **Default**: `true`\n\nIf true, then the strings matched will be automatically rendered using the config pre/post and escapeHTML.\n\nIn case you want to render it yourself, set it to false, and set `includeMatches` to true.\nYou will need the intervals to call the method render.\n\n### escapeHTML\n\n* **Type**: `boolean`\n* **Default**: `false`\n\nWhether the filtering should escape the HTML characters that can be found in each record in the result\n\n### pre\n\n* **Type**: `string`\n* **Default**: `''`\n\nShould be used to prefix each matched characters. Can be useful for the highlighting.\n\n### post\n\n* **Type**: `string`\n* **Default**: `''`\n\nShould be used to suffix each matched characters. Can be useful for the highlighting.\n\n## Contributions\nAny contribution or suggestion would be really appreciated. Feel free to [file an issue](https://github.com/Nexucis/fuzzy/issues) or [send a pull request](https://github.com/Nexucis/fuzzy/pulls).\n\n## License\n[MIT](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexucis%2Ffuzzy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnexucis%2Ffuzzy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexucis%2Ffuzzy/lists"}