{"_id":"@_greataxe/indexed-object","_rev":"1-d1f4986951197225b2e88172b5b083f9","name":"@_greataxe/indexed-object","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@_greataxe/indexed-object","version":"1.0.0","keywords":["typescript","indexed","collection","utility"],"author":"","license":"MIT","_id":"@_greataxe/indexed-object@1.0.0","maintainers":[{"name":"_greataxe","email":"manjunath.r@knownshare.in"}],"homepage":"https://github.com/newboy2006hosur/indexed-object#readme","bugs":{"url":"https://github.com/newboy2006hosur/indexed-object/issues"},"dist":{"shasum":"619efe6bbf669f540749723ad342e26dfeef1457","tarball":"https://registry.npmjs.org/@_greataxe/indexed-object/-/indexed-object-1.0.0.tgz","fileCount":4,"integrity":"sha512-hhbJVSUupk/UxizKVl/r8mTkAjSXlwyqlM13bQXvAH/Lnc4mjI6riCLy9Snebkbn/lZ7kAfzh02bmm39N2GHFA==","signatures":[{"sig":"MEQCIHi34Xid51wEoAFgCus6qRJOfrf0AkmnRw4Kdhh1T1AFAiA90MkEXT8V6uc6ly5+n8RExDZginUgQIdyrwQHfbdm9Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6094},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18"},"gitHead":"372ced513f85a57672ea367d60bb9dc56f2ab3fc","release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"],"branches":["main"]},"scripts":{"lint":"eslint src --ext .ts","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","semantic-release":"semantic-release"},"_npmUser":{"name":"_greataxe","email":"manjunath.r@knownshare.in"},"repository":{"url":"git+https://github.com/newboy2006hosur/indexed-object.git","type":"git"},"_npmVersion":"10.8.2","description":"A TypeScript utility for working with indexed collections of objects","directories":{},"_nodeVersion":"20.18.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.50.0","vitest":"^0.34.5","typescript":"^5.2.2","@types/node":"^20.8.0","semantic-release":"^21.1.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^10.0.5","@semantic-release/github":"^9.0.4","@typescript-eslint/parser":"^6.7.3","@semantic-release/changelog":"^6.0.3","@typescript-eslint/eslint-plugin":"^6.7.3","@semantic-release/commit-analyzer":"^10.0.4","@semantic-release/release-notes-generator":"^11.0.7"},"_npmOperationalInternal":{"tmp":"tmp/indexed-object_1.0.0_1740227821546_0.6969830233501253","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@_greataxe/indexed-object","version":"1.2.0","description":"A TypeScript utility for working with indexed collections of objects","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","lint":"eslint src --ext .ts","prepare":"npm run build","semantic-release":"semantic-release"},"keywords":["typescript","indexed","collection","utility"],"author":"","license":"MIT","engines":{"node":">=18"},"devDependencies":{"@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^10.0.4","@semantic-release/git":"^10.0.1","@semantic-release/github":"^9.0.4","@semantic-release/npm":"^10.0.5","@semantic-release/release-notes-generator":"^11.0.7","@types/node":"^20.8.0","@typescript-eslint/eslint-plugin":"^6.7.3","@typescript-eslint/parser":"^6.7.3","eslint":"^8.50.0","semantic-release":"^21.1.1","typescript":"^5.2.2","vitest":"^0.34.5"},"publishConfig":{"access":"public"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"repository":{"type":"git","url":"git+https://github.com/newboy2006hosur/indexed-object.git"},"_id":"@_greataxe/indexed-object@1.2.0","gitHead":"d509eab39c6f83cc3262f023ab4726460b64c6c0","bugs":{"url":"https://github.com/newboy2006hosur/indexed-object/issues"},"homepage":"https://github.com/newboy2006hosur/indexed-object#readme","_nodeVersion":"18.20.6","_npmVersion":"9.9.4","dist":{"integrity":"sha512-YUyBg1s1gUQqGWES9lM9LZra+p+m/uyOmblhS27gPRRJJLa7ijoWEokxgIhvf4vs3jqi47Fm1QIMZ8luqqBAjQ==","shasum":"562733c47ab4c8c88867615b384fb5cc0f1fb3ae","tarball":"https://registry.npmjs.org/@_greataxe/indexed-object/-/indexed-object-1.2.0.tgz","fileCount":4,"unpackedSize":6094,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD9+GtVjwoRyL6w4o8SiQ370N5MK5UdHG46JijRA4DdngIhAPdM0w2wGPV/wu3TSJuk7l4UO0ypR3ZZSJKoK5xzDDEB"}]},"_npmUser":{"name":"_greataxe","email":"manjunath.r@knownshare.in"},"directories":{},"maintainers":[{"name":"_greataxe","email":"manjunath.r@knownshare.in"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/indexed-object_1.2.0_1740228297920_0.7626246840247777"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-22T12:37:01.459Z","modified":"2025-02-22T12:44:58.331Z","1.0.0":"2025-02-22T12:37:01.766Z","1.2.0":"2025-02-22T12:44:58.144Z"},"bugs":{"url":"https://github.com/newboy2006hosur/indexed-object/issues"},"license":"MIT","homepage":"https://github.com/newboy2006hosur/indexed-object#readme","keywords":["typescript","indexed","collection","utility"],"repository":{"type":"git","url":"git+https://github.com/newboy2006hosur/indexed-object.git"},"description":"A TypeScript utility for working with indexed collections of objects","maintainers":[{"name":"_greataxe","email":"manjunath.r@knownshare.in"}],"readme":"# indexed-object\n\nA TypeScript utility for working with indexed collections of objects. This package provides an efficient way to work with arrays of objects that have unique identifiers, offering features like indexing, sorting, filtering, and more.\n\n## Installation\n\n```bash\nnpm install indexed-object\n```\n\n## Usage\n\n```typescript\nimport { IndexedObject } from 'indexed-object';\n\n// Create a new indexed collection\nconst users = new IndexedObject([\n  { user_id: 1, name: 'John', age: 30 },\n  { user_id: 2, name: 'Jane', age: 25 }\n], 'user_id');\n\n// Access by index\nconst firstUser = users.get(0);\n\n// Access by ID\nconst userById = users.getById(2);\n\n// Sort users by age\nconst sortedUsers = users.sortBy('age');\n\n// Filter users\nconst filteredUsers = users.filterBy(user => user.age > 25);\n\n// Add new user\nusers.add({ user_id: 3, name: 'Bob', age: 35 });\n\n// Remove user\nusers.remove(2);\n\n// Get original array\nconst array = users.toArray();\n\n// Create a deep copy\nconst copy = users.deepCopy();\n```\n\n## Features\n\n- Access items by index or ID\n- Sort collection by any property\n- Filter collection\n- Add/remove items\n- Convert to array\n- Create deep copies\n- TypeScript support\n- Immutable operations (sort/filter return new instances)\n\n## API\n\n### Constructor\n\n```typescript\nnew IndexedObject<T>(data: T[], idKey: keyof T)\n```\n\n### Methods\n\n- `get(index: number): T | undefined` - Get item by index\n- `getById(id: any): T | undefined` - Get item by ID\n- `sortBy(key: keyof T, direction?: 'asc' | 'desc'): IndexedObject<T>` - Sort collection\n- `filterBy(predicate: (item: T) => boolean): IndexedObject<T>` - Filter collection\n- `toArray(): T[]` - Convert to array\n- `add(item: T): void` - Add new item\n- `remove(id: any): boolean` - Remove item by ID\n- `deepCopy(): IndexedObject<T>` - Create deep copy\n\n## License\n\nMIT","readmeFilename":"README.md"}