just-shuffle
TypeScript icon, indicating that this package has built-in type declarations

4.2.0 • Public • Published

just-shuffle

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-shuffle
yarn add just-shuffle

Return the elements of an array in random order

import shuffle from 'just-shuffle';

shuffle([1, 2, 3]); 
// array with original elements randomly sorted
shuffle([1, 2, 3], {shuffleAll: true}); 
// array with original elements randomly sorted and all in new postions
shuffle([]); // []
shuffle([1]); // [1]
shuffle(); // throws
shuffle(undefined); // throws
shuffle(null); // throws
shuffle({}); // throws

Package Sidebar

Install

npm i just-shuffle

Weekly Downloads

3,284

Version

4.2.0

License

MIT

Unpacked Size

5.55 kB

Total Files

9

Last publish

Collaborators

  • angus-c