{"id":45538289,"url":"https://github.com/webeach/collection","last_synced_at":"2026-02-23T02:58:19.356Z","repository":{"id":290236150,"uuid":"973793778","full_name":"webeach/collection","owner":"webeach","description":"Managed collection of items with hooks, events, and strict type safety","archived":false,"fork":false,"pushed_at":"2026-01-13T16:11:42.000Z","size":350,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T18:35:50.021Z","etag":null,"topics":["collection","dataset","library","list","state-machine","state-management","typed-collections","typed-list","typescript","typescript-library"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/webeach.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-27T18:46:01.000Z","updated_at":"2026-01-05T22:48:49.000Z","dependencies_parsed_at":"2025-05-21T21:22:49.875Z","dependency_job_id":"f42b20f7-229c-4378-9491-ffe24c537cfc","html_url":"https://github.com/webeach/collection","commit_stats":null,"previous_names":["webeach/collection"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/webeach/collection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webeach%2Fcollection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webeach%2Fcollection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webeach%2Fcollection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webeach%2Fcollection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webeach","download_url":"https://codeload.github.com/webeach/collection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webeach%2Fcollection/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29735860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T02:24:00.660Z","status":"ssl_error","status_checked_at":"2026-02-23T02:22:56.087Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["collection","dataset","library","list","state-machine","state-management","typed-collections","typed-list","typescript","typescript-library"],"created_at":"2026-02-23T02:58:18.731Z","updated_at":"2026-02-23T02:58:19.350Z","avatar_url":"https://github.com/webeach.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"Collection\" src=\"./assets/logo.svg\" height=\"192\"\u003e\n  \u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@webeach/collection\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/@webeach/collection.svg?color=104F85\u0026labelColor=1E7EBA\" alt=\"npm package\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@webeach/collection\"\u003e\n      \u003cimg src=\"https://img.shields.io/bundlephobia/minzip/@webeach/collection?label=size\u0026color=104F85\u0026labelColor=1E7EBA\" alt=\"Bundle size\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/webeach/collection/actions/workflows/ci.yml\"\u003e\n      \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/molefrog/wouter/size.yml?color=104F85\u0026labelColor=1E7EBA\" alt=\"build\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@webeach/collection\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/dm/@webeach/collection.svg?color=104F85\u0026labelColor=1E7EBA\" alt=\"npm downloads\" /\u003e\n    \u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/coderabbit/prs/github/webeach/collection?utm_source=oss\u0026utm_medium=github\u0026utm_campaign=webeach%2Fcollection\u0026labelColor=1E7EBA\u0026color=104F85\u0026link=https%3A%2F%2Fcoderabbit.ai\u0026label=CodeRabbit+Reviews\" alt=\"\"\u003e\n  \u003c/p\u003e\n  \u003cp\u003e\u003ca href=\"./README.md\"\u003e🇺🇸 English version\u003c/a\u003e | \u003ca href=\"./README.ru.md\"\u003e🇷🇺 Русская версия\u003c/a\u003e\u003c/p\u003e\n  \u003cp\u003eManaged collection of items with hooks, events, and strict type safety.\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install @webeach/collection\n```\n\nor\n\n```bash\npnpm install @webeach/collection\n```\n\nor\n\n```bash\nyarn add @webeach/collection\n```\n\n---\n\n## 📥 Importing\n\n**ES Modules**\n\n```ts\nimport { Collection } from '@webeach/collection';\n```\n\n**CommonJS**\n\n```ts\nconst { Collection } = require('@webeach/collection');\n```\n\n**Browser**\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { Collection } from 'https://unpkg.com/@webeach/collection'; \n\u003c/script\u003e\n```\n\n---\n\n## 🚀 Quick Start\n\n### Adding users\n\n```ts\nimport { Collection } from '@webeach/collection';\n\nconst users = new Collection({\n  primaryKey: 'id',\n});\n\nusers.appendItem({\n  id: 1,\n  firstName: 'Ivan',\n  lastName: 'Petrov',\n});\n\nusers.appendItem({\n  id: 2,\n  firstName: 'Jason',\n  lastName: 'Statham',\n});\n\nconsole.log(users.numItems); // 2\nconsole.log(users.getItem(2).firstName); // Jason\n```\n\n### Adding and replacing an item\n\n```ts\nimport { Collection } from '@webeach/collection';\n\nconst products = new Collection({\n  primaryKey: 'sku',\n});\n\nproducts.appendItem({ sku: 'A001', name: 'Laptop' });\nproducts.replaceItem('A001', { sku: 'A001', name: 'Laptop Pro' });\n\nconsole.log(products.getItem('A001')?.name); // 'Laptop Pro'\n```\n\n---\n\n### Bulk replacing items with `setItems`\n\n```ts\nimport { Collection } from '@webeach/collection';\n\nconst tasks = new Collection({\n  primaryKey: 'id',\n  initialItems: [\n    { id: 1, title: 'Initial Task 1' },\n    { id: 2, title: 'Initial Task 2' },\n  ],\n});\n\n// Completely replace the collection content\ntasks.setItems([\n  { id: 3, title: 'New Task 3' },\n  { id: 4, title: 'New Task 4' },\n]);\n\nconsole.log(tasks.numItems); // 2\nconsole.log(tasks.getItem(3)?.title); // 'New Task 3'\n```\n\n---\n\n## 🛠 API\n\n### `Collection`\n\n+ [constructor](./docs/en/Collection/constructor.md)\n+ Methods\n  + [appendItem](./docs/en/Collection/methods/appendItem.md)\n  + [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener)\n  + [appendItemAt](./docs/en/Collection/methods/appendItemAt.md)\n  + [clear](./docs/en/Collection/methods/clear.md)\n  + [dispatchEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent)\n  + [forEach](./docs/en/Collection/methods/forEach.md)\n  + [getItem](./docs/en/Collection/methods/getItem.md)\n  + [hasItem](./docs/en/Collection/methods/hasItem.md)\n  + [insertItemAfter](./docs/en/Collection/methods/insertItemAfter.md)\n  + [insertItemBefore](./docs/en/Collection/methods/insertItemBefore.md)\n  + [patchItem](./docs/en/Collection/methods/patchItem.md)\n  + [removeEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener)\n  + [removeItem](./docs/en/Collection/methods/removeItem.md)\n  + [replaceItem](./docs/en/Collection/methods/replaceItem.md)\n  + [reset](./docs/en/Collection/methods/reset.md)\n  + [setItems](./docs/en/Collection/methods/setItems.md)\n  + [\\[Symbol.iterator\\]](./docs/en/Collection/methods/[Symbol.iterator].md)\n+ Properties\n  + [numItems](./docs/en/Collection/properties/numItems.md)\n  + [onUpdate](./docs/en/Collection/properties/onUpdate.md)\n+ Hooks\n  + [clear:*](./docs/en/Collection/hooks/clear.md)\n  + [insert:*](./docs/en/Collection/hooks/insert.md)\n  + [patch:*](./docs/en/Collection/hooks/patch.md)\n  + [remove:*](./docs/en/Collection/hooks/remove.md)\n\n### `CollectionUpdateEvent`\n\n+ [constructor](./docs/en/CollectionUpdateEvent/constructor.md)\n+ Inherits [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) API\n\n---\n\n## 🔖 Releasing a new version\n\nReleases are handled automatically using `semantic-release`.\n\nBefore publishing a new version, make sure:\n\n1. All changes are committed and pushed to the `main` branch.\n2. Commit messages follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) format:\n   - `feat: ...` — for new features\n   - `fix: ...` — for bug fixes\n   - `chore: ...`, `refactor: ...`, etc. — as needed\n3. Versioning is automatically determined based on commit types (`patch`, `minor`, `major`).\n\n---\n\n## 👨‍💻 Author\n\nDevelopment and maintenance: [Ruslan Martynov](https://github.com/ruslan-mart)\n\nIf you have suggestions or found a bug, feel free to open an issue or submit a pull request.\n\n---\n\n## 📄 License\n\nThis package is distributed under the [MIT License](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebeach%2Fcollection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebeach%2Fcollection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebeach%2Fcollection/lists"}