{"_id":"@bernardpolidario/shuffle","_rev":"3-b2014ff0846474cf21921126e21f3984","name":"@bernardpolidario/shuffle","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@bernardpolidario/shuffle","version":"1.0.0","keywords":["shuffle","array"],"author":{"name":"Bernard Polidario"},"license":"ISC","_id":"@bernardpolidario/shuffle@1.0.0","maintainers":[{"name":"bernardpolidario","email":"bernard@betterstack.com"}],"homepage":"https://github.com/polidario/shuffle#readme","bugs":{"url":"https://github.com/polidario/shuffle/issues"},"dist":{"shasum":"4d2774d6ea8fe0c56b06c0787a4a17ab90f619df","tarball":"https://registry.npmjs.org/@bernardpolidario/shuffle/-/shuffle-1.0.0.tgz","fileCount":2,"integrity":"sha512-dwPBClyleaIrQhlTdVMkE1pgTaekbGn++FpLRYIZBFZFYRxToN4Ox8Fy+LxvQ8ZmmSWT28HH5E2RSMfNliNuDA==","signatures":[{"sig":"MEYCIQCw6GoEKUFix88HcJi6gEUolwiCAHiUofNkSI6f7k1UswIhAN+pXGq7PrNS0SWBfhrmreiWDAloc7tWt0Wsl5LNQpgc","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":792},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"bernardpolidario","actor":{"name":"bernardpolidario","type":"user","email":"bernard@betterstack.com"},"email":"bernard@betterstack.com"},"repository":{"url":"git+https://github.com/polidario/shuffle.git","type":"git"},"_npmVersion":"10.8.3","description":"A tool that shuffles the array you input","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/shuffle_1.0.0_1750327479785_0.9032413317713046","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bernardpolidario/shuffle","version":"1.0.1","keywords":["shuffle","array"],"author":{"name":"Bernard Polidario"},"license":"ISC","_id":"@bernardpolidario/shuffle@1.0.1","maintainers":[{"name":"bernardpolidario","email":"bernard@betterstack.com"}],"homepage":"https://github.com/polidario/shuffle#readme","bugs":{"url":"https://github.com/polidario/shuffle/issues"},"dist":{"shasum":"ffbb7a3a26ef18dcd5b59cf06395281d3d05acfc","tarball":"https://registry.npmjs.org/@bernardpolidario/shuffle/-/shuffle-1.0.1.tgz","fileCount":3,"integrity":"sha512-RtXZcK2DaOU3xYqWCsZZ2ewyfHkXM0BCJ8sNY+mhWBtfsSDYpN2c31JowSgd1763UUXQHU847Oe5XQ6hvLZajg==","signatures":[{"sig":"MEUCIDq+r9SbqLUZ5EOddD7OdyFR+VNU1wx1cWdeFLE2ik5TAiEAiCe7nmiqvQpcMm7VBbrXlP+9n34dY/bv5u3ErpKtM+k=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2191},"main":"index.js","gitHead":"2819f4536e0635dbd30fe4d98f96b845f95db82d","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"bernardpolidario","actor":{"name":"bernardpolidario","type":"user","email":"bernard@betterstack.com"},"email":"bernard@betterstack.com"},"repository":{"url":"git+https://github.com/polidario/shuffle.git","type":"git"},"_npmVersion":"10.8.3","description":"A tool that shuffles the array you input","directories":{},"_nodeVersion":"18.17.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/shuffle_1.0.1_1750327944958_0.11140163951007809","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bernardpolidario/shuffle","version":"1.0.2","description":"A tool that shuffles the array you input","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/polidario/shuffle.git"},"keywords":["shuffle","array"],"author":{"name":"Bernard Polidario"},"license":"ISC","bugs":{"url":"https://github.com/polidario/shuffle/issues"},"homepage":"https://github.com/polidario/shuffle#readme","_id":"@bernardpolidario/shuffle@1.0.2","gitHead":"9853c98531acb8a6f31ba016e3adc97b7465db95","_nodeVersion":"18.17.0","_npmVersion":"10.8.3","dist":{"integrity":"sha512-uzLZ9bxRbKjugTenKQY90AvYnqV9SBf/bd8TiXeRLFOXw4/GtwgkUvqdD/LAe7APpKVZDhxFmCIBLF8QtVQs0w==","shasum":"9b3d3a914434a0effd46c62c3854f3ea4288e391","tarball":"https://registry.npmjs.org/@bernardpolidario/shuffle/-/shuffle-1.0.2.tgz","fileCount":3,"unpackedSize":2175,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCAEqYeKQ6CtKLI57qWN5gr1SbZZjGRIyJ3Hb0vy8znPgIgbhFeStGX1Ja+L/vRbENNEP+SsGmGBOvyxOi4m0jQkuY="}]},"_npmUser":{"name":"bernardpolidario","email":"bernard@betterstack.com","actor":{"name":"bernardpolidario","email":"bernard@betterstack.com","type":"user"}},"directories":{},"maintainers":[{"name":"bernardpolidario","email":"bernard@betterstack.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shuffle_1.0.2_1750328169988_0.3589043069207405"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-19T10:04:39.660Z","modified":"2025-06-19T10:16:10.350Z","1.0.0":"2025-06-19T10:04:39.952Z","1.0.1":"2025-06-19T10:12:25.138Z","1.0.2":"2025-06-19T10:16:10.161Z"},"bugs":{"url":"https://github.com/polidario/shuffle/issues"},"author":{"name":"Bernard Polidario"},"license":"ISC","homepage":"https://github.com/polidario/shuffle#readme","keywords":["shuffle","array"],"repository":{"type":"git","url":"git+https://github.com/polidario/shuffle.git"},"description":"A tool that shuffles the array you input","maintainers":[{"name":"bernardpolidario","email":"bernard@betterstack.com"}],"readme":"# 🔀 shuffle\n\nA lightweight utility to shuffle the elements of an array in place using the Fisher–Yates algorithm.\n\n---\n\n## 🚀 Installation\n\nInstall via npm:\n\n```\nnpm install @bernardpolidario/shuffle\n```\n\n---\n\n## 📦 Usage\n\n```js\nconst shuffleArray = require('@bernardpolidario/shuffle');\n\nconst items = ['apple', 'banana', 'cherry', 'date'];\nconst shuffled = shuffleArray(items);\n\nconsole.log(shuffled); \n// → [ 'cherry', 'apple', 'date', 'banana' ] (order will vary)\n```\n\n> ⚠️ **Note:** The original array is **mutated**. If you want to preserve the original, clone it first:\n\n```js\nconst shuffled = shuffleArray([...items]);\n```\n\n---\n\n## 🧠 How It Works\n\nThis package uses the [Fisher–Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle), a time-tested algorithm that ensures every possible ordering of the array is equally likely.\n\n---\n\n## 📄 API\n\n### `shuffleArray(array)`\n\n- **Parameters**:\n  - `array` — An array of any type (e.g. strings, numbers, objects).\n- **Returns**:\n  - The same array, shuffled in place.\n\n---\n\n## ✅ Example Use Cases\n\n- Randomizing quiz options\n- Shuffling playlist items\n- Mixing flashcards\n- Creating randomized test data\n\n---\n\n## 🔧 Development\n\nTo test this package locally:\n\n```\nnpm link\n# then in another project\nnpm link @bernardpolidario/shuffle\n```\n\n---\n\n## 📜 License\n\nMIT © 2025 Your Name\n","readmeFilename":"README.md"}