{"id":20806338,"url":"https://github.com/nodesource/index-list","last_synced_at":"2025-05-11T17:31:46.371Z","repository":{"id":33841819,"uuid":"37543911","full_name":"nodesource/index-list","owner":"nodesource","description":"Build up an indexed list of strings. Useful for minimising the size of categorical data when transferring it over the wire.","archived":true,"fork":false,"pushed_at":"2015-06-16T17:13:06.000Z","size":120,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-13T21:38:42.078Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-16T17:01:23.000Z","updated_at":"2025-01-30T21:18:06.000Z","dependencies_parsed_at":"2022-08-17T23:00:42.641Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/index-list","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Findex-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Findex-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Findex-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Findex-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/index-list/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604864,"owners_count":21934911,"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":[],"created_at":"2024-11-17T19:19:24.997Z","updated_at":"2025-05-11T17:31:46.125Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# index-list\n![](http://img.shields.io/badge/stability-experimental-orange.svg?style=flat)\n![](http://img.shields.io/npm/v/index-list.svg?style=flat)\n![](http://img.shields.io/npm/dm/index-list.svg?style=flat)\n![](http://img.shields.io/npm/l/index-list.svg?style=flat)\n\nBuild up an indexed list of strings. Useful for minimising the size of categorical data when transferring it over the wire.\n\n## Usage\n\n[![NPM](https://nodei.co/npm/index-list.png)](https://nodei.co/npm/index-list/)\n\n### `list = IndexList([initial], [options])`\n\nCreates a new indexed list.\n\n### `list.push(elements...)`\n\nAdds one or more new elements to the end of the list.\n\n### `list.toJSON()`\n\nCreates a serialized version of the input data, ready to be stringified into\nJSON, which can later be loaded with `IndexList.load()`.\n\nNote that while this is generally more compact, you can\nreduce the size further by storing the `items` as binary\ndata using a `Uint32Array` or similar. Alternatively you\ncan convert that data into base64 and expand before loading\nit again.\n\n### `IndexList.load(json)`\n\nLoads a previously serialized `IndexList`, returning a new\ninstance.\n\n``` javascript\nvar list = IndexList(data)\nvar copy = IndexList.load(list.toJSON())\n\n// copy.expand() ~= list.expand()\n```\n\n### `list.expand()`\n\nCreates an expanded copy of the stored values, representing the original\ninput data.\n\n``` javascript\nvar list = IndexList(['hello', 'world', 'again', 'hello', 'hello', 'world', 'again', 'again'])\n\n// list.toJSON() ~= { items: [0, 1, 2, 0, 0, 1, 2, 2], index: ['hello', 'world', 'again'] }\n// list.expand() ~= ['hello', 'world', 'again', 'hello', 'hello', 'world', 'again', 'again']\n```\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/nodesource/index-list/blob/master/LICENSE.md) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Findex-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Findex-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Findex-list/lists"}