{"_id":"@chatwoot/pico-search","_rev":"2-27bc721ac696f6e71d47a4011c5aba2a","name":"@chatwoot/pico-search","dist-tags":{"latest":"0.6.2"},"versions":{"0.6.1":{"name":"@chatwoot/pico-search","version":"0.6.1","keywords":["fuzzy search","pico-search"],"license":"MIT","_id":"@chatwoot/pico-search@0.6.1","maintainers":[{"name":"muhsin-k","email":"muhsin@chatwoot.com"},{"name":"sivin","email":"iamsivin@gmail.com"},{"name":"pranavrajs","email":"pranavrajs@gmail.com"},{"name":"scmmishra","email":"shivam@shivam.dev"}],"homepage":"https://github.com/chatwoot/pico-search","bugs":{"url":"https://github.com/chatwoot/pico-search/issues"},"dist":{"shasum":"ef1d0223b84bad5ddd4864e9dd25e5974a8ee94f","tarball":"https://registry.npmjs.org/@chatwoot/pico-search/-/pico-search-0.6.1.tgz","fileCount":3,"integrity":"sha512-MUc2N2bIGUv88WBBDf6rNu/45G9Pn6WI76aPgvHP+T6GKpWPWQFAQXQXNQ4AWh9J3WhZJ6/JPer7c0XntMzrnw==","signatures":[{"sig":"MEYCIQDlwQV/VkcYqu4yWRqamveAn8YTjuv34SgJkogwHi6W+wIhANPVbyipOx5dV3wTd2WtV3Hj3eP5Ab5Q5IUpc6FHd65Y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5916},"main":"dist/index.cjs","type":"module","types":"dist/index.d.cts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"8df27d66ceab2a8110dda9f4b7d17bbf2d55667c","scripts":{"dev":"tsdown --watch","size":"size-limit","test":"vitest","build":"tsdown","coverage":"vitest run --coverage","benchmark":"vitest bench"},"_npmUser":{"name":"scmmishra","email":"shivam@shivam.dev"},"repository":{"url":"git+https://github.com/chatwoot/pico-search.git","type":"git"},"size-limit":[{"path":"dist/index.cjs","limit":"1.2 kB"}],"_npmVersion":"11.4.2","description":"A tiny fuzzy search engine","directories":{},"_nodeVersion":"24.4.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^5.2.11","jsdom":"^24.1.0","tsdown":"^0.20.3","vitest":"^1.6.0","size-limit":"^11.1.4","typescript":"^5.4.5","@types/node":"^20.12.12","@size-limit/esbuild":"^11.1.4","@vitest/coverage-v8":"^1.6.0","@size-limit/esbuild-why":"^11.1.4","@size-limit/preset-small-lib":"^11.1.4"},"_npmOperationalInternal":{"tmp":"tmp/pico-search_0.6.1_1786963067633_0.31049185919176625","host":"s3://npm-registry-packages-npm-production"}},"0.6.2":{"name":"@chatwoot/pico-search","description":"A tiny fuzzy search engine","version":"0.6.2","license":"MIT","homepage":"https://github.com/chatwoot/pico-search","keywords":["fuzzy search","pico-search"],"repository":{"type":"git","url":"git+https://github.com/chatwoot/pico-search.git"},"bugs":{"url":"https://github.com/chatwoot/pico-search/issues"},"publishConfig":{"access":"public"},"exports":{".":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"}}},"main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.cts","type":"module","scripts":{"dev":"tsdown --watch","build":"tsdown","test":"vitest","benchmark":"vitest bench","size":"size-limit","coverage":"vitest run --coverage"},"devDependencies":{"@size-limit/esbuild":"^11.1.4","@size-limit/esbuild-why":"^11.1.4","@size-limit/preset-small-lib":"^11.1.4","@types/node":"^20.12.12","jsdom":"^24.1.0","size-limit":"^11.1.4","tsdown":"^0.20.3","typescript":"^5.4.5","vite":"^5.2.11","vitest":"^1.6.0","@vitest/coverage-v8":"^1.6.0"},"size-limit":[{"path":"dist/index.cjs","limit":"1.2 kB"}],"_id":"@chatwoot/pico-search@0.6.2","gitHead":"5986db15ec453de15e7706ed4abe0c97251e8c42","_nodeVersion":"24.4.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-uZnt/c06sN3epXv42uzweoqKLCY94s+h9vpbw/1SYCPTww4kCo18vUUD3QZ7tPPSBQB130Fjc79tLQMSWoGt4w==","shasum":"afaad5c62b93de84f15480d97151633c74b87f15","tarball":"https://registry.npmjs.org/@chatwoot/pico-search/-/pico-search-0.6.2.tgz","fileCount":9,"unpackedSize":26699,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIG4Jo+/VvPFkqrkbfPgiHXqWR6DOc4DetPzKQCUviKCXAiEA74da/2g1romrW3FZ6BtslAozg1qhTS++RbAE+1fQMB0="}]},"_npmUser":{"name":"scmmishra","email":"shivam@shivam.dev"},"directories":{},"maintainers":[{"name":"muhsin-k","email":"muhsin@chatwoot.com"},{"name":"sivin","email":"iamsivin@gmail.com"},{"name":"pranavrajs","email":"pranavrajs@gmail.com"},{"name":"scmmishra","email":"shivam@shivam.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pico-search_0.6.2_1786963173853_0.6746348297058868"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T10:37:47.405Z","modified":"2026-08-17T10:39:34.261Z","0.6.1":"2026-08-17T10:37:47.788Z","0.6.2":"2026-08-17T10:39:34.004Z"},"bugs":{"url":"https://github.com/chatwoot/pico-search/issues"},"license":"MIT","homepage":"https://github.com/chatwoot/pico-search","keywords":["fuzzy search","pico-search"],"repository":{"type":"git","url":"git+https://github.com/chatwoot/pico-search.git"},"description":"A tiny fuzzy search engine","maintainers":[{"name":"muhsin-k","email":"muhsin@chatwoot.com"},{"name":"sivin","email":"iamsivin@gmail.com"},{"name":"pranavrajs","email":"pranavrajs@gmail.com"},{"name":"scmmishra","email":"shivam@shivam.dev"}],"readme":"<div align=\"center\">\n<br>\n<br>\n<p>\n  <img src=\".github/mascot.png\" style=\"height: 150px;\">\n  <h1>pico-search</h1>\n</p>\n<br>\n<br>\n\n![npm](https://img.shields.io/npm/dm/%40chatwoot%2Fpico-search)\n\n</div>\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 an fzf-style subsequence matching algorithm with word boundary awareness, and allows for weighting of search keys. At under 750 bytes (minified + brotli), it's 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 @chatwoot/pico-search\n```\n\n```sh\nnpm install @chatwoot/pico-search\n```\n\n```sh\nyarn add @chatwoot/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 config argument. It returns an array of objects that match the search term, ranked by relevance.\n\n```typescript\nimport { picoSearch } from \"@chatwoot/pico-search\";\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\nSubsequence matching means you can type scattered characters and still find results:\n\n```typescript\npicoSearch(people, \"cd\", [\"name\"]);\n// [{ name: \"Charlie\", age: 35 }, { name: \"David\", age: 40 }]\n```\n\nMulti-word queries match each term independently across all keys:\n\n```typescript\nconst data = [\n  { name: \"John Doe\", city: \"New York\" },\n  { name: \"Jane Smith\", city: \"Boston\" },\n];\n\npicoSearch(data, \"John New\", [\n  { name: \"name\", weight: 3 },\n  { name: \"city\", weight: 2 },\n]);\n// [{ name: \"John Doe\", city: \"New York\" }]\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### Threshold\n\nPicoSearch includes a minimum score threshold to filter out weak matches. The default threshold is 0.3. You can adjust it in the config:\n\n```typescript\nconst results = picoSearch(people, searchTerm, keys, {\n  threshold: 0.5,\n});\n```\n\nHigher values return fewer, more precise results. Lower values return more results with looser matching.\n\n## How it works\n\nPicoSearch uses a greedy forward+reverse subsequence scan inspired by fzf:\n\n1. **Forward scan** finds the first valid subsequence match\n2. **Reverse scan** tightens the match to the smallest window\n3. **Scoring** rewards consecutive character runs, word boundary matches (spaces, hyphens, camelCase), and prefix hits\n4. **Normalization** with a mild length penalty prefers shorter targets as a tiebreaker\n\n## License\n\nPicoSearch is released under the MIT License. See LICENSE for details.\n","readmeFilename":"README.md"}