{"id":16190221,"url":"https://github.com/apsavin/micromys","last_synced_at":"2025-03-19T03:30:54.218Z","repository":{"id":44004488,"uuid":"237780163","full_name":"apsavin/micromys","owner":"apsavin","description":"Helper for IDE-like search widgets implementations","archived":false,"fork":false,"pushed_at":"2022-02-13T00:17:11.000Z","size":273,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T15:08:29.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/apsavin.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-02-02T14:04:58.000Z","updated_at":"2023-09-10T19:34:30.000Z","dependencies_parsed_at":"2022-09-26T19:40:12.157Z","dependency_job_id":null,"html_url":"https://github.com/apsavin/micromys","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsavin%2Fmicromys","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsavin%2Fmicromys/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsavin%2Fmicromys/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apsavin%2Fmicromys/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apsavin","download_url":"https://codeload.github.com/apsavin/micromys/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965775,"owners_count":20375917,"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-10-10T07:38:57.473Z","updated_at":"2025-03-19T03:30:53.997Z","avatar_url":"https://github.com/apsavin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Micromys\n\nA tiny tool that helps to find strings in pre-defined dictionary by user input. \nIt uses algorithm similar to one that IDEs use when user looks for a file by some parts of the file's name. \nFor example, it finds string `aTinyTool` when input is `att`.\n\n## Installation\n\n`yarn add micromys` or `npm install micromys`\n\n## Usage\n\n### Basic\n\n```js\nimport { createSearchFunction } from 'micromys';\n\nconst search = createSearchFunction(['myFavoriteFile', 'i_love_underscores']);\n\nconst searchResults = search('ilo');\nconsole.log(searchResults); \n// [{ \n//   sentence: 'i_love_underscores', \n//   highlights: [\n//     { start: 0, end: 0 },\n//     { start: 2, end: 3 },\n//   ], \n// }]\n```\n\n### Advanced\n\nYou can think of this module as of a constructor.\nFeel free to import any parts of `micromys` and to build something new from them.\nYou can start from `createSearchFunction.js` - the place that wires all the sub parts. \nFor example, you can provide your own custom `isLetter` function in order to add support for languages with non-latin alphabets.\n\n### Highlighting\n\nIn order to simplify highlighting implementation there is `highlightSentence` function.\n\n```js\nimport { highlightSentence } from 'micromys/src/highlightSentence';\n\nconst highlighted = highlightSentence({ \n  sentence: 'some words',\n  highlights: [{ start: 0, end: 3 }],\n  highlight: (text) =\u003e `\u003cb\u003e${text}\u003c/b\u003e`,\n}).join('');\n\nconsole.log(highlighted); // '\u003cb\u003esome\u003c/b\u003e words'\n```\n\n### CommonJS support\n\nIf you need to `require` instead of `import`, use `require('micromys/cjs');`\n\n## Limitations\n\nBy default `micromys` supports only latin alphabet. If you need more, see `Advanced` section above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsavin%2Fmicromys","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapsavin%2Fmicromys","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapsavin%2Fmicromys/lists"}