{"_id":"@amscotti/merry-go-round","name":"@amscotti/merry-go-round","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@amscotti/merry-go-round","version":"1.0.0","type":"module","description":"Create a round robin proxy for iterating over arrays","main":"index.js","types":"./types/index.d.ts","scripts":{"check":"tsc --noEmit true","build":"tsc --emitDeclarationOnly true --noEmitOnError","prepublishOnly":"npm run build","lint":"standard --fix","test":"tsc --noEmit true && standard && ava","coverage":"c8 --all --reporter=html --reporter=text npm test"},"repository":{"type":"git","url":"git+https://github.com/amscotti/merry-go-round.git"},"keywords":["proxy","round robin","iterator","array","cycle","rotate"],"author":{"name":"anthony.m.scotti@gmail.com"},"license":"MIT","devDependencies":{"ava":"^5.3.1","c8":"^8.0.1","standard":"^17.1.0","typescript":"^5.1.6"},"_id":"@amscotti/merry-go-round@1.0.0","gitHead":"d4d1531209e80390ec9aa0b6c0cdb156d68bfb2d","bugs":{"url":"https://github.com/amscotti/merry-go-round/issues"},"homepage":"https://github.com/amscotti/merry-go-round#readme","_nodeVersion":"20.5.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-I+dPTtOI3m3I3ygWRX7IU6kGAAlpr2yP6TMBB0EER9cmPNF/gIjNu/od81h5nzL9rImHpvDCXK4OCbMOnXkJmQ==","shasum":"dbeb549497e38cf5bade8a88cac52341a21ee83e","tarball":"https://registry.npmjs.org/@amscotti/merry-go-round/-/merry-go-round-1.0.0.tgz","fileCount":7,"unpackedSize":4854,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGgyxRAmwEEx76dXJdDIxkhD4bGRoX6bMZGMYzcLr1yuAiEA3zllkc3K7s4sceZP0uF4etqS5cwHBleYIbqTSfH3NW4="}]},"_npmUser":{"name":"amscotti","email":"npmjs@services.scotti.io"},"directories":{},"maintainers":[{"name":"amscotti","email":"npmjs@services.scotti.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/merry-go-round_1.0.0_1692758812695_0.10809865103433136"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-23T02:46:52.546Z","1.0.0":"2023-08-23T02:46:52.919Z","modified":"2023-08-23T02:46:53.249Z"},"maintainers":[{"name":"amscotti","email":"npmjs@services.scotti.io"}],"description":"Create a round robin proxy for iterating over arrays","homepage":"https://github.com/amscotti/merry-go-round#readme","keywords":["proxy","round robin","iterator","array","cycle","rotate"],"repository":{"type":"git","url":"git+https://github.com/amscotti/merry-go-round.git"},"author":{"name":"anthony.m.scotti@gmail.com"},"bugs":{"url":"https://github.com/amscotti/merry-go-round/issues"},"license":"MIT","readme":"# merry-go-round\nRound robin proxy for iterating over arrays.\n\n## Install\n```bash\nnpm install @amscotti/merry-go-round\n```\n\n## Usage\n\n```js\nimport { createRoundRobin } from '@amscotti/merry-go-round'\n\nconst items = [{\n  name: 'Alice',\n  greet() {\n    return `Hello, ${this.name}` \n  }\n}, {\n  name: 'Bob',\n  greet() {\n    return `Hi, ${this.name}`\n  }\n}]\n\nconst proxy = createRoundRobin(items)\n\nproxy.greet() // 'Hello, Alice!' \nproxy.greet() // 'Hi, Bob!'\nproxy.greet() // 'Hello, Alice!'\n```\n\n`createRoundRobin` takes an array and returns a Proxy that rotates over the items, exposing their properties and methods.\n\nThis allows iterating over an array in a round robin manner easily.\n\n## API\n\n### createRoundRobin\n\n```ts\nfunction createRoundRobin<T>(items: T[]): T\n```\n\nCreates a round robin proxy over the given array of items.\n\n- `items` - Array of objects to iterate over.\n- Returns a Proxy wrapping the items.\n\nThe proxy will rotate over the items and proxy property/method access to the next item.","readmeFilename":"readme.md"}