{"_id":"@bobbythecatfish/no-repeat","_rev":"3-c40cb2d9e4c0fca4795b3d3530c5bf34","name":"@bobbythecatfish/no-repeat","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@bobbythecatfish/no-repeat","version":"1.0.0","keywords":["array","random","repeat","no repeat","randomization"],"author":{"name":"BobbyTheCatfish"},"license":"MIT","_id":"@bobbythecatfish/no-repeat@1.0.0","maintainers":[{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"}],"dist":{"shasum":"f28c75160e74c4faeb1d9efdd8cdc82952924f15","tarball":"https://registry.npmjs.org/@bobbythecatfish/no-repeat/-/no-repeat-1.0.0.tgz","fileCount":8,"integrity":"sha512-UK3Lqe7EkI20ANBBHTFtxFPjFliSNiBvn9jRIjBOP0eZlUOAbPmZ4NnpAZvSlKjjNMcHUAj3tBbPhwc+QGTYwg==","signatures":[{"sig":"MEUCIQD6VfaaDE11jt+cMAWJjONJSq5L5oiK54ZzzJefe9tN4gIgTtyxC6NpcO9GJXXSK21uA4dQDCSgSV4KMHJOZnRk8wQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13019},"main":"dist/no-repeat.js","gitHead":"a1fda7a1a06bd94a91275955e4ea7660b992500b","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"},"_npmVersion":"10.5.2","description":"Get random preset strings or objects at any time without repetition","directories":{},"_nodeVersion":"20.13.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/no-repeat_1.0.0_1739603579932_0.11996573779915409","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bobbythecatfish/no-repeat","version":"1.0.1","keywords":["array","random","repeat","no repeat","randomization"],"author":{"name":"BobbyTheCatfish"},"license":"MIT","_id":"@bobbythecatfish/no-repeat@1.0.1","maintainers":[{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"}],"homepage":"https://github.com/BobbyTheCatfish/no-repeat.git","bugs":{"url":"https://github.com/BobbyTheCatfish/no-repeat/issues"},"dist":{"shasum":"c5381c89e3cb291f92bca94cbfde063e8f3230a8","tarball":"https://registry.npmjs.org/@bobbythecatfish/no-repeat/-/no-repeat-1.0.1.tgz","fileCount":8,"integrity":"sha512-d3u81uhvZB+zdUx36YQ6/O/imJwCYf6wgtNJViSGwPDuF55Akh6/6/DTo8yBJly8AZ2HMv9NrHA1OOb14qclkQ==","signatures":[{"sig":"MEQCIGfpIVR17NsB3DTLYHWuqjtpEZyncAaoZw3U8gT/R6pVAiBLCyqMk8H4g6l9wSYum0X142Yk1IcI+kRhTnqkLQdGow==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13250},"main":"dist/no-repeat.js","types":"dist/no-repeat.ts","gitHead":"667f17270365696a1e6058eb31d7e1f18f108ccd","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"},"repository":{"url":"git+https://github.com/BobbyTheCatfish/no-repeat.git","type":"git"},"_npmVersion":"10.5.2","description":"Get random preset strings or objects at any time without repetition","directories":{},"_nodeVersion":"20.13.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/no-repeat_1.0.1_1739604187222_0.5584099519184684","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@bobbythecatfish/no-repeat","version":"1.1.0","keywords":["array","random","repeat","no repeat","randomization"],"author":{"name":"BobbyTheCatfish"},"license":"MIT","_id":"@bobbythecatfish/no-repeat@1.1.0","maintainers":[{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"}],"homepage":"https://github.com/BobbyTheCatfish/no-repeat.git","bugs":{"url":"https://github.com/BobbyTheCatfish/no-repeat/issues"},"dist":{"shasum":"05dc0f5659d16cd36e2e3e754788d6958e2c0c56","tarball":"https://registry.npmjs.org/@bobbythecatfish/no-repeat/-/no-repeat-1.1.0.tgz","fileCount":8,"integrity":"sha512-bu7BI24ckK51+heHev7HQtGbGStBMFAC81EphwO1XbjisH7Q0CgEfwFgEx9o31c9kqwWcG5OM+45jOOcCoDtyw==","signatures":[{"sig":"MEQCIAvlIq0WF2ZEcoZZGwpzBKPS2QRbPqCH+CnsFsKUVGTBAiA56YgW8LlMb2zJfMyqq6nifoJIAkMmAmEihXAtFjJTGw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14354},"main":"dist/no-repeat.js","types":"dist/no-repeat.ts","gitHead":"77f2d311eeec573a7c577cf00c92224f87ae0830","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"},"repository":{"url":"git+https://github.com/BobbyTheCatfish/no-repeat.git","type":"git"},"_npmVersion":"10.5.2","description":"Get random preset strings or objects at any time without repetition","directories":{},"_nodeVersion":"20.13.1","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/no-repeat_1.1.0_1739751459196_0.7939599897894714","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@bobbythecatfish/no-repeat","version":"1.1.1","description":"Get random preset strings or objects at any time without repetition","main":"dist/no-repeat.js","types":"dist/no-repeat.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["array","random","repeat","no repeat","randomization"],"author":{"name":"BobbyTheCatfish"},"repository":{"type":"git","url":"git+https://github.com/BobbyTheCatfish/no-repeat.git"},"homepage":"https://github.com/BobbyTheCatfish/no-repeat.git","license":"MIT","devDependencies":{"typescript":"^5.7.3"},"_id":"@bobbythecatfish/no-repeat@1.1.1","gitHead":"0f963391fbe29c922ae41a988e7b1d3907735de3","bugs":{"url":"https://github.com/BobbyTheCatfish/no-repeat/issues"},"_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-eE28MtqzmGYoR73gOnbUxzlXEvVZ4n6/9ERo62URM6MQHPElWE3Ns+xt8vC5h9Pg5g4wrcWsyNlJHU6ZYTWBSQ==","shasum":"a8da39b4919bfbe5399ef2ae9dfa1c7807b7b338","tarball":"https://registry.npmjs.org/@bobbythecatfish/no-repeat/-/no-repeat-1.1.1.tgz","fileCount":8,"unpackedSize":14346,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCdI8xYOE6XWJ806gyRrTtx6bZzbbCOSusttotpjs/YpQIgSIoONUQfVVdryWENm6n58TNN8eEYfNVSi37Hm8q0j0A="}]},"_npmUser":{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"},"directories":{},"maintainers":[{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/no-repeat_1.1.1_1739751562152_0.6021604412102031"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-15T07:12:59.858Z","modified":"2025-02-17T00:19:22.515Z","1.0.0":"2025-02-15T07:13:00.124Z","1.0.1":"2025-02-15T07:23:07.431Z","1.1.0":"2025-02-17T00:17:39.392Z","1.1.1":"2025-02-17T00:19:22.343Z"},"bugs":{"url":"https://github.com/BobbyTheCatfish/no-repeat/issues"},"author":{"name":"BobbyTheCatfish"},"license":"MIT","homepage":"https://github.com/BobbyTheCatfish/no-repeat.git","keywords":["array","random","repeat","no repeat","randomization"],"repository":{"type":"git","url":"git+https://github.com/BobbyTheCatfish/no-repeat.git"},"description":"Get random preset strings or objects at any time without repetition","maintainers":[{"name":"bobbythecatfish","email":"bobby@bobbythecat.fish"}],"readme":"<div align=\"center\">\n    <h1>No-Repeat</h1>\n    <p>Random Results Without Repetition</p>\n</div>\n\nA utility class for randomly selecting items from an array without repetition.\nIt ensures that each item is only picked once before resetting, while preventing the most recent item from being selected consecutively.\n\nIdeal for scenarios that require randomized selection without repetition.\n\nWritten in TypeScript with no dependencies.\n\n## Installation\n```bash\nnpm install --save no-repeat@npm:@bobbythecatfish/no-repeat\n```\n\n## Usage\n```js\nconst NoRepeat = require(\"no-repeat\");\n\n// load data into NoRepeats\n// strings are used for these demos, but it works with any variable type\nconst intros = new NoRepeat(data.intros);\nconst names = new NoRepeat(data.names);\nconst excuses = new NoRepeat(data.excuses);\n\nfunction makeExcuse() {\n    // generate a randomized and unique output\n    return `<${intros.getRandom()}> <${names.getRandom()}> <${excuses.getRandom()}>!`;\n}\n// example output 1: \"<It's been great talking to you, but> <Bobby> <is trying to tag me>!\"\n// example output 2: \"<Look. I'll be completely honest with you.> <A snail> <has been perfecting its taco recipe and I gotta try it>!\"\n```\n\n## Advanced Usage\nReset-Delayed Options\n```js\nconst NoRepeat = require(\"no-repeat\");\n\nconst firstSet = [\"Tom\", \"David\", \"Bobby\"];\nconst secondSet = [\"Larry\", \"Terry\", \"Jerry\"];\n\n// Tom, David, and Bobby will be the only possible responses for the first 3 calls of getRandom().\nconst arr = new NoRepeat(firstSet, undefined, secondSet);\nconst a = arr.getRandom(); // Tom\nconst b = arr.getRandom(); // David\nconst c = arr.getRandom(); // Bobby\n// At this point, arr is reset and the second set are mixed in with the first\n// Bobby is not a possible result until the next reset since it was picked last\nconst d = arr.getRandom(); // David\nconst e = arr.getRandom(); // Larry\nconst f = arr.getRandom(); // Tom\n...\n```\n\nFaster Reset\n```js\nconst NoRepeat = require(\"no-repeat\");\n\nconst set = [\"Tom\", \"David\", \"Bobby\", \"Larry\", \"Terry\", \"Jerry\"];\n\n// reset after returning 4 elements instead of all 6\nconst arr = new NoRepeat(set, 4);\n\nconst a = arr.getRandom(); // Terry\nconst b = arr.getRandom(); // David\nconst c = arr.getRandom(); // Tom\nconst d = arr.getRandom(); // Jerry\n// at this point, arr is reset.\n// Jerry is not a possible response until the next reset.\nconst e = arr.getRandom(); // Larry\nconst f = arr.getRandom(); // Tom\n// another reset just for fun.\n// Since this is a complete reset, Tom *is* a possible response despite being picked last.\narr.reset();\n...\n```\n`arr.resetAt` can be changed at any time.\n\nAdding to items\n```js\nconst NoRepeat = require(\"no-repeat\");\n\nconst set = [\"Tom\", \"David\", \"Bobby\"];\n\nconst arr = new NoRepeat(set);\nconst a = arr.getRandom(); // Bobby\n\n// add a new element into the mix\narr.items.push(\"Larry\");\n\nconst b = arr.getRandom() // Larry\n```\nThe same can be done with `arr.used.push()` to make it a possible selection after the next reset.","readmeFilename":"README.md"}