{"id":17239285,"url":"https://github.com/indiesquidge/autocomplete","last_synced_at":"2025-07-30T12:35:30.258Z","repository":{"id":82547960,"uuid":"135192895","full_name":"indiesquidge/autocomplete","owner":"indiesquidge","description":"low-level, primitive autocomplete using trie data structure","archived":false,"fork":false,"pushed_at":"2018-06-25T04:47:19.000Z","size":30,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-14T02:32:45.562Z","etag":null,"topics":["autocomplete","javascript","trie-structure","trie-tree-autocomplete"],"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/indiesquidge.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,"zenodo":null}},"created_at":"2018-05-28T17:53:16.000Z","updated_at":"2023-12-01T07:44:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd5c1ab1-5c2c-4db8-b606-7a9503454223","html_url":"https://github.com/indiesquidge/autocomplete","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/indiesquidge/autocomplete","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesquidge%2Fautocomplete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesquidge%2Fautocomplete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesquidge%2Fautocomplete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesquidge%2Fautocomplete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/indiesquidge","download_url":"https://codeload.github.com/indiesquidge/autocomplete/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/indiesquidge%2Fautocomplete/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267867822,"owners_count":24157357,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["autocomplete","javascript","trie-structure","trie-tree-autocomplete"],"created_at":"2024-10-15T05:48:15.075Z","updated_at":"2025-07-30T12:35:30.248Z","avatar_url":"https://github.com/indiesquidge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autocomplete\n\nA low-level, primitive autocomplete using trie data structure\n\n\n## Features\n\nThis autocomplete library has the ability to insert words manually, get word\nsuggestions based on a query, populate the data structure with a dictionary\narray of words, and delete undesired words.\n\n_NOTE: The library is not populated with any words by default._\n\n### Insertion\n\n```javascript\nconst completion = createTrie();\n\ncompletion.insert(\"hello\");\n\ncompletion.count(); // =\u003e 1\n\ncompletion.insert(\"world\");\n\ncompletion.count(); // =\u003e 2\n```\n\n\n### Suggestions\n\n```javascript\ncompletion.suggest(\"he\"); // =\u003e ['hello']\n\ncompletion.insert(\"hellen\");\n\ncompletion.suggest(\"he\"); // =\u003e [\"hello\", \"hellen\"]\n\ncompletion.suggest(\"w\"); // =\u003e [\"world\"]\n```\n\n\n### Population\n\n```javascript\nconst fs = require(\"fs\");\nconst text = \"/usr/share/dict/words\";\nconst dictionary = fs.readFileSync(text).toString().trim().split(\"\\n\");\nconst completion = createTrie();\n\ncompletion.populate(dictionary);\n\ncompletion.suggest(\"world\"); // =\u003e [ 'world', 'worlded', 'worldful', …]\n```\n\n\n### Deletion\n\n```javascript\ncompletion.suggest(\"world\"); // =\u003e ['world', 'worlded', 'worldful', …]\n\ncompletion.delete(\"worlded\");\n\ncompletion.suggest(\"world\"); // =\u003e ['world', 'worldful', …]\n```\n\n\n## Future Improvements\n\n- [ ] case-insensitive suggestions\n  - it'd be nice to be able to type in \"ap\" and have something like \"Apache\"\n    come up as a suggestion; since keys are strings in JS and strings are\n    case-sensitive, this would require a bit of refactoring around how we\n    discover the `startNode` in `Trie#suggest`\n\n- [ ] substring suggestions\n  - right now, words are only displayed as suggestions if the word is prefixed\n      by the query; a better implementation would include suggestions that have\n      the query as a substring appearing anywhere in the word, not just as a\n      prefix; e.g., querying in \"ist\" would return suggestions like \"istle\" and\n      \"isthmus\", but also \"listen\"\n\n---\n\n_Inspired by the [\"Compelete-Me\"][1] project from the Turing School of Software \u0026\nDesign_\n\n[1]: http://frontend.turing.io/projects/complete-me.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiesquidge%2Fautocomplete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Findiesquidge%2Fautocomplete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Findiesquidge%2Fautocomplete/lists"}