{"id":15672530,"url":"https://github.com/scmmishra/pico-search","last_synced_at":"2025-04-13T11:52:51.175Z","repository":{"id":154401679,"uuid":"632049914","full_name":"scmmishra/pico-search","owner":"scmmishra","description":"A pico sized (\u003e 1kb) typo-tolerant word matching library","archived":false,"fork":false,"pushed_at":"2024-05-27T18:02:33.000Z","size":29646,"stargazers_count":18,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T04:17:42.573Z","etag":null,"topics":["jaro-winkler","javascript","lightweight-fuzzy-search","pico-search","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/scmmishra.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":"2023-04-24T15:51:05.000Z","updated_at":"2025-03-07T17:35:52.000Z","dependencies_parsed_at":"2025-01-07T11:46:17.620Z","dependency_job_id":null,"html_url":"https://github.com/scmmishra/pico-search","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmmishra%2Fpico-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmmishra%2Fpico-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmmishra%2Fpico-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scmmishra%2Fpico-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scmmishra","download_url":"https://codeload.github.com/scmmishra/pico-search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248471362,"owners_count":21109418,"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":["jaro-winkler","javascript","lightweight-fuzzy-search","pico-search","search","typescript"],"created_at":"2024-10-03T15:27:55.309Z","updated_at":"2025-04-13T11:52:51.155Z","avatar_url":"https://github.com/scmmishra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cp\u003e\n  \u003cimg src=\".github/mascot.png\" style=\"height: 150px;\"\u003e\n  \u003ch1\u003epico-search\u003c/h1\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n![npm](https://img.shields.io/npm/dm/%40scmmishra%2Fpico-search) ![Less than 1KB](https://deno.bundlejs.com/?q=@scmmishra/pico-search\u0026badge)\n\u003cbr\u003e\n![DeepSource](https://deepsource.io/gh/scmmishra/pico-search.svg/?label=active+issues\u0026show_trend=true\u0026token=_HAIDwNbi1ocMhaBKxB_BcSQ)\n![DeepSource](https://deepsource.io/gh/scmmishra/pico-search.svg/?label=resolved+issues\u0026show_trend=true\u0026token=_HAIDwNbi1ocMhaBKxB_BcSQ)\n\n\u003c/div\u003e\n\nPicoSearch is a lightweight fuzzy search JavaScript library that provides developers with an easy-to-use, efficient way to perform fuzzy searches on arrays of objects. It uses the Jaro-Winkler distance algorithm, and allows for weighting of search keys. PicoSearch is designed to be simple to use and integrate into any project, making it an excellent choice for developers looking for a fast, lightweight search solution.\n\n[Try on CodeSandbox](https://codesandbox.io/s/picosearch-demo-i79btf)\n\n## Installation\n\n```sh\npnpm install @scmmishra/pico-search\n```\n\n```sh\nnpm install @scmmishra/pico-search\n```\n\n```sh\nyarn add @scmmishra/pico-search\n```\n\n## Usage\n\nPicoSearch exposes a single function: `picoSearch()`. This function takes an array of objects, a search term, an array of keys to search against, and an optional algorithm argument. It returns an array of objects that match the search term. You can find the [typedoc here](https://paka.dev/npm/@scmmishra/pico-search/api)\n\n```typescript\nimport { picoSearch } from \"picosearch\";\n\ninterface Person {\n  name: string;\n  age: number;\n}\n\nconst people: Person[] = [\n  { name: \"Alice\", age: 25 },\n  { name: \"Bob\", age: 30 },\n  { name: \"Charlie\", age: 35 },\n  { name: \"David\", age: 40 },\n];\n\nconst searchTerm = \"ali\";\nconst keys = [\"name\"];\n\nconst results = picoSearch(people, searchTerm, keys);\nconsole.log(results); // [{ name: \"Alice\", age: 25 }]\n```\n\n## Options\n\n### Weighted Keys\n\nBy default, all keys passed to `picoSearch()` are weighted equally. You can specify a weight for a specific key by passing an object with `name` and `weight` properties instead of a string in the `keys` array.\n\n```typescript\nconst keys = [{ name: \"name\", weight: 2 }, \"age\"];\n```\n\nWeights are relative, so a key with a weight of 2 will be considered twice as important as a key with a weight of 1.\n\n### Minimum Distance Threshold\n\nPicoSearch includes a minimum distance threshold to filter out results that are too far from the search term. The default threshold is 0.8, but you can adjust it by changing the value in the if statement at the end of the loop that processes each object.\n\n```typescript\nconst results = picoSearch(people, searchTerm, keys, {\n  threshold: 0.5,\n});\n```\n\n## Acknowledgements\n\nPicoSearch uses the Jaro-Winkler distance algorithm which was developed by William E. Winkler and Matthew Jaro.\n\n## License\n\nPicoSearch is released under the MIT License. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscmmishra%2Fpico-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscmmishra%2Fpico-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscmmishra%2Fpico-search/lists"}