{"id":15629689,"url":"https://github.com/anko/scatter-rank","last_synced_at":"2025-10-29T14:34:05.435Z","repository":{"id":57159699,"uuid":"41272987","full_name":"anko/scatter-rank","owner":"anko","description":"Node.js \"command-T\"-style approximate string matching","archived":false,"fork":false,"pushed_at":"2019-11-21T18:37:44.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T07:46:20.215Z","etag":null,"topics":["fuzzy-matching","javascript","rank"],"latest_commit_sha":null,"homepage":"","language":"LiveScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anko.png","metadata":{"files":{"readme":"readme.markdown","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":"2015-08-24T00:18:15.000Z","updated_at":"2019-11-21T18:37:46.000Z","dependencies_parsed_at":"2022-09-08T13:32:13.385Z","dependency_job_id":null,"html_url":"https://github.com/anko/scatter-rank","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anko%2Fscatter-rank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anko%2Fscatter-rank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anko%2Fscatter-rank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anko%2Fscatter-rank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anko","download_url":"https://codeload.github.com/anko/scatter-rank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223325,"owners_count":20743168,"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":["fuzzy-matching","javascript","rank"],"created_at":"2024-10-03T10:28:10.448Z","updated_at":"2025-10-29T14:34:00.384Z","avatar_url":"https://github.com/anko.png","language":"LiveScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scatter-rank [![](https://img.shields.io/npm/v/scatter-rank.svg?style=flat-square)][1] [![](https://img.shields.io/travis/anko/scatter-rank.svg?style=flat-square)][2]\n\nThis is a very similar (identical?) matcher algorighm as behind [TextMate][3]'s\n\u003ckbd\u003eCmd\u003c/kbd\u003e+\u003ckbd\u003eT\u003c/kbd\u003e feature, [the `command-t` vim plugin][4] and [Emacs\nIcicles `scatter-match` completion][5], as a Node.js library.\n\nExports a function that looks for a subsequence of a given sequence of\ncharacters in an input string, ignoring other characters, and outputs what\nproportion of that sequence was found, as a number between 0 and 1.\n\nKind of like `/.*a.*b.*c.*/`, while counting the longest a-b-c subsequence.\n\n## Why\n\nThis works great to rank some text items from which a user wants to choose one\nreally quickly by approximately typing it.  The heuristic is simple,\npredictable and tolerates abbreviations and inaccurate typing.\n\nFor example, a user might type \"nsfudt\", and scatter-rank would find that it\nmatches *100%* with \"node js foundation\" (because all the letters are there in\nthe right order), *somewhat* also with \"apache foundation\" (because \"fudt\" is\nin there) and *hardly at all* with \"wikipedia\" (because only the \"d\" would\nhit).\n\n## Examples\n\n    var rank = scatterRank(\"abcd\");\n\n    rank(\"abcd\")        // =\u003e 1     all OK\n    rank(\"abc\")         // =\u003e 0.75  \"d\" wasn't found\n    rank(\"XYZ\")         // =\u003e 0     nothing found\n    rank(\"gah\")         // =\u003e 0.25  only \"a\" found\n    rank(\"_a___b_c_d_\") // =\u003e 1     all OK\n    rank(\"dcba\")        // =\u003e 0.25  only \"d\" found; rest were out of order\n    rank(\"cab\")         // =\u003e 0.5   \"ab\" was longest matching subsequence\n\nAlternatively, pass the *string to search in* as second parameter:\n\n    scatterRank(\"abcd\", \"i know my abcs\") // =\u003e 0.75\n\n## Related libraries\n\n-   [*fast-levenshtein*][6] is better for ranking mispellings and\n    approximations, but too rigid for abbreviations to match well.\n\n-   [*string_score*][7] is like a fuzzy, more complex version of this.  It's\n    better for natural language use-cases where you don't necessarily know much\n    about the string you're looking for.  Modifies the `String` prototype.\n\n-   [*fuzzy*][8] is more complex, can't produce a rank value, and to be honest\n    I don't understand what it does.\n\n-   [*fuzzy-filter*][9] can filter strings for matches and do fancy\n    highlighting stuff, but also can't produce a similarity value.\n\n## License\n\n[ISC][10].\n\n[1]: https://www.npmjs.com/package/scatter-rank\n[2]: https://travis-ci.org/anko/scatter-rank\n[3]: https://macromates.com/\n[4]: https://github.com/wincent/Command-T\n[5]: http://www.emacswiki.org/emacs?action=browse;oldid=Icicles_-_Fuzzy_Completion;id=Icicles_-_Completion_Methods_and_Styles#toc7\n[6]: https://github.com/hiddentao/fast-levenshtein\n[7]: https://github.com/joshaven/string_score\n[8]: https://github.com/mattyork/fuzzy\n[9]: https://github.com/stratuseditor/fuzzy-filter\n[10]: http://opensource.org/licenses/ISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanko%2Fscatter-rank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanko%2Fscatter-rank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanko%2Fscatter-rank/lists"}