{"id":47619620,"url":"https://github.com/emmanuel-ferdman/solists","last_synced_at":"2026-04-01T21:56:31.617Z","repository":{"id":64501922,"uuid":"576273514","full_name":"emmanuel-ferdman/solists","owner":"emmanuel-ferdman","description":"⛓️ Dynamic data management with self-organizing lists","archived":false,"fork":false,"pushed_at":"2026-03-21T17:37:07.000Z","size":1158,"stargazers_count":21,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-03-22T04:09:27.960Z","etag":null,"topics":["data-structures","javascript","linked-list","list","self-organizing-list","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/solists","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/emmanuel-ferdman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-09T12:34:44.000Z","updated_at":"2026-03-21T17:43:13.000Z","dependencies_parsed_at":"2026-01-04T03:01:04.510Z","dependency_job_id":null,"html_url":"https://github.com/emmanuel-ferdman/solists","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/emmanuel-ferdman/solists","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmanuel-ferdman%2Fsolists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmanuel-ferdman%2Fsolists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmanuel-ferdman%2Fsolists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmanuel-ferdman%2Fsolists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emmanuel-ferdman","download_url":"https://codeload.github.com/emmanuel-ferdman/solists/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emmanuel-ferdman%2Fsolists/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["data-structures","javascript","linked-list","list","self-organizing-list","typescript"],"created_at":"2026-04-01T21:56:26.442Z","updated_at":"2026-04-01T21:56:31.611Z","avatar_url":"https://github.com/emmanuel-ferdman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/emmanuel-ferdman/solists\"\u003e\n    \u003cpicture\u003e\n      \u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/logo.png\" height=\"128\"\u003e\n    \u003c/picture\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A TypeScript implementation of \u003ca href=\"https://en.wikipedia.org/wiki/Self-organizing_list\"\u003eself-organizing lists\u003c/a\u003e with native Array methods.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/solists\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/solists.svg\" alt=\"npm version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/solists\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/solists.svg\" alt=\"npm downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/emmanuel-ferdman/solists/actions\"\u003e\u003cimg src=\"https://github.com/emmanuel-ferdman/solists/workflows/CI/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/emmanuel-ferdman/solists\"\u003e\u003cimg src=\"https://codecov.io/gh/emmanuel-ferdman/solists/graph/badge.svg\" alt=\"Coverage\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/emmanuel-ferdman/solists/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/solists.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```sh\nnpm install solists\n```\n\n## Example\n\n\u003cdiv align=\"center\"\u003e\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003eVisualization\u003c/th\u003e\n\u003cth\u003eCode\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/frequency-count.gif\" width=\"300\" /\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eFrequencyCountSoList\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nconst l = new FrequencyCountSoList([\"A\", \"B\", \"C\", \"D\", \"E\"]);\nl.includes(\"D\"); // D(1) -\u003e front\nl.includes(\"B\"); // B(1) -\u003e #2\nl.includes(\"B\"); // B(2) overtakes D\n// Result: [\"B\", \"D\", \"A\", \"C\", \"E\"]\n```\n\n\u003c/details\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/k-in-a-row.gif\" width=\"300\" /\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eKInARowSoList\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nconst l = new KInARowSoList([\"A\", \"B\", \"C\", \"D\", \"E\"], { k: 2 });\nl.includes(\"D\"); // D: 1st access, no move\nl.includes(\"D\"); // D: 2nd access, -\u003e front\nl.includes(\"B\"); // B: 1st access, no move\n// Result: [\"D\", \"A\", \"B\", \"C\", \"E\"]\n```\n\n\u003c/details\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/move-ahead-k.gif\" width=\"300\" /\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMoveAheadKSoList\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nconst l = new MoveAheadKSoList([\"A\", \"B\", \"C\", \"D\", \"E\"], { k: 2 });\nl.includes(\"D\"); // D moves 2 ahead\nl.includes(\"E\"); // E moves 2 ahead\nl.includes(\"B\"); // B moves 2 ahead\n// Result: [\"A\", \"B\", \"D\", \"E\", \"C\"]\n```\n\n\u003c/details\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/move-to-front.gif\" width=\"300\" /\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMoveToFrontSoList\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nconst l = new MoveToFrontSoList([\"A\", \"B\", \"C\", \"D\", \"E\"]);\nl.includes(\"D\"); // D -\u003e front\nl.includes(\"B\"); // B -\u003e front\nl.includes(\"C\"); // C -\u003e front\n// Result: [\"C\", \"B\", \"D\", \"A\", \"E\"]\n```\n\n\u003c/details\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg src=\"https://raw.githubusercontent.com/emmanuel-ferdman/solists/main/img/transpose.gif\" width=\"300\" /\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTransposeSoList\u003c/strong\u003e\u003c/summary\u003e\n\n```javascript\nconst l = new TransposeSoList([\"A\", \"B\", \"C\", \"D\", \"E\"]);\nl.includes(\"D\"); // D swaps with C\nl.includes(\"E\"); // E swaps with C\nl.includes(\"B\"); // B swaps with A\n// Result: [\"B\", \"A\", \"D\", \"E\", \"C\"]\n```\n\n\u003c/details\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n## How It Works\n\nA self-organizing list (or _SoList_) reorders elements based on access patterns to improve search efficiency. Frequently accessed items move toward the head, achieving near constant-time access in the best case.\n\n**Supported heuristics:**\n\n- **Frequency Count** - Accessed elements ordered by access count\n- **k-in-a-Row** - Accessed element moves to front after k consecutive accesses\n- **Move-Ahead-k** - Accessed element moves k positions toward the head\n- **Move to Front** - Accessed element moves directly to the head\n- **Transpose** - Accessed element swaps with its predecessor\n\n### Access Only Mode\n\nBy default (`accessOnly: true`), the list only rearranges on search operations. To also rearrange when adding elements, set `accessOnly: false`:\n\n```javascript\nconst l = new MoveToFrontSoList([1, 2, 3], { accessOnly: false });\n```\n\n**Methods that trigger rearrangement:**\n\n- Always: `at()`, `find()`, `findIndex()`, `findLast()`, `findLastIndex()`, `includes()`, `indexOf()`, `lastIndexOf()`\n- When `accessOnly: false`: `push()`, `unshift()`, `insert()`\n\n## API\n\n**Properties:**\n\n\u003cdiv align=\"center\"\u003e\n\n| Name     | Description                    |\n| :------- | :----------------------------- |\n| `length` | Number of elements in the list |\n\n\u003c/div\u003e\n\n**Methods:**\n\n\u003cdiv align=\"center\"\u003e\n\n| Name                  | Description                                                   |\n| :-------------------- | :------------------------------------------------------------ |\n| `[Symbol.iterator]()` | Returns an iterator that yields each value                    |\n| `at()`                | Returns the value at a given index                            |\n| `concat()`            | Returns a new SoList merged with given iterables              |\n| `copyWithin()`        | Shallow copies part of list to another location               |\n| `entries()`           | Returns an iterator of key/value pairs                        |\n| `every()`             | Checks if every element satisfies a predicate                 |\n| `fill()`              | Changes all elements to a static value                        |\n| `filter()`            | Creates a new SoList with elements satisfying a predicate     |\n| `find()`              | Returns the first element satisfying a predicate              |\n| `findIndex()`         | Returns the index of the first element satisfying a predicate |\n| `findLast()`          | Returns the last element satisfying a predicate               |\n| `findLastIndex()`     | Returns the index of the last element satisfying a predicate  |\n| `flat()`              | Creates a new SoList with sub-lists flattened                 |\n| `flatMap()`           | Maps then flattens the result by one level                    |\n| `forEach()`           | Executes a function for each element                          |\n| `includes()`          | Determines whether a value exists in the list                 |\n| `indexOf()`           | Returns the first index of a given element                    |\n| `insert()`            | Adds an element at a specific index                           |\n| `isEmpty()`           | Checks if the list contains no elements                       |\n| `isEqual()`           | Checks if the list equals a given iterable                    |\n| `join()`              | Joins all elements into a string                              |\n| `keys()`              | Returns an iterator of keys                                   |\n| `lastIndexOf()`       | Returns the last index of a given element                     |\n| `map()`               | Creates a new SoList with mapped values                       |\n| `pop()`               | Removes and returns the last element                          |\n| `push()`              | Adds elements to the end                                      |\n| `reduce()`            | Reduces values to a single value (left-to-right)              |\n| `reduceRight()`       | Reduces values to a single value (right-to-left)              |\n| `remove()`            | Removes the element at a specific index                       |\n| `reverse()`           | Reverses the order of elements                                |\n| `shift()`             | Removes and returns the first element                         |\n| `slice()`             | Returns a shallow copy of a portion                           |\n| `some()`              | Checks if any element satisfies a predicate                   |\n| `sort()`              | Sorts the elements                                            |\n| `splice()`            | Adds/removes elements                                         |\n| `toLocaleString()`    | Returns a localized string representation                     |\n| `toReversed()`        | Returns a reversed copy                                       |\n| `toSorted()`          | Returns a sorted copy                                         |\n| `toSpliced()`         | Returns a spliced copy                                        |\n| `toString()`          | Returns a string representation                               |\n| `unshift()`           | Adds elements to the beginning                                |\n| `values()`            | Returns an iterator of values                                 |\n| `with()`              | Returns copy with element at index replaced                   |\n\n\u003c/div\u003e\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. For contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nThe library is freely distributable under the terms of the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuel-ferdman%2Fsolists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmanuel-ferdman%2Fsolists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmanuel-ferdman%2Fsolists/lists"}