{"id":16125568,"url":"https://github.com/semibran/list","last_synced_at":"2025-07-18T05:08:20.562Z","repository":{"id":130492054,"uuid":"90556755","full_name":"semibran/list","owner":"semibran","description":":scroll: Lightweight and context-free array operations","archived":false,"fork":false,"pushed_at":"2017-07-02T17:32:30.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T13:12:42.527Z","etag":null,"topics":["array","list"],"latest_commit_sha":null,"homepage":"","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/semibran.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}},"created_at":"2017-05-07T19:34:21.000Z","updated_at":"2018-03-12T16:19:37.000Z","dependencies_parsed_at":"2024-03-15T04:16:45.723Z","dependency_job_id":null,"html_url":"https://github.com/semibran/list","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/semibran/list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Flist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Flist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Flist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Flist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semibran","download_url":"https://codeload.github.com/semibran/list/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semibran%2Flist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265703605,"owners_count":23814038,"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":["array","list"],"created_at":"2024-10-09T21:30:00.927Z","updated_at":"2025-07-18T05:08:20.536Z","avatar_url":"https://github.com/semibran.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# list\n\u003e Lightweight and context-free array operations\n\n## usage\n[![NPM](https://nodei.co/npm/list.png?mini)](https://www.npmjs.com/package/list)\n```js\n// ES6:\nconst { append, insert, remove, locate } = require('list')\n```\n```js\n// ES5:\nvar append = require('list/append')\n```\n\n### `append(list, item)`\nAdds `item` to the end of `list` and returns `list`.\n```js\n\u003e append(['foo', 'bar'], 'baz')\n['foo', 'bar', 'baz']\n```\n\n### `insert(list, index, item)`\nInserts `item` at `index` in `list`. The item in `list` located at `index` and all subsequent items are shifted by one index to accommodate `item`.\n```js\n\u003e insert(['foo', 'baz'], 1, 'bar')\n['foo', 'bar', 'baz']\n```\nTo prepend to a list, insert at index `0`.\n```js\n\u003e insert(['bar', 'baz'], 0, 'foo')\n['foo', 'bar', 'baz']\n```\n`list` is not modified if `index` is less than `0` or greater than or equal to `list.length`. Therefore, `insert` cannot be used to add items to the end of a list - use `append` instead.\n\n### `remove(list, index)`\nRemoves the item located at `index` from `list`. Returns the item if it exists, otherwise `undefined`.\n```js\n\u003e remove(['foo', 'bar', 'baz'], 1)\n'bar'\n```\n```js\n\u003e remove(['foo', 'bar', 'baz'], 'qux')\nundefined\n```\n\n### `locate(list, item)`\nFinds the first index where `list[index] === item`, or `undefined` if no item is found.\n```js\n\u003e locate(['foo', 'bar', 'baz'], 'baz')\n2\n```\n```js\n\u003e locate(['foo', 'bar', 'baz'], 'qux')\nundefined\n```\n\n## see also\n- [`semibran/map`](https://github.com/semibran/map) - simple key-value maps\n\n## kudos\n- [leo](https://github.com/leo) - for donating the package name\n\n## license\n[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Flist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemibran%2Flist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemibran%2Flist/lists"}