secret-santa-draw
v1.1.1
Published
This is a [Node.js](https://nodejs.org/en/) module available through the [npm registry](https://www.npmjs.com/).
Downloads
5
Readme
Installation
This is a Node.js module available through the npm registry.
Before installing, download and install Node.js.
If this is a brand new project, make sure to create a package.json
first with
the npm init
command.
Installation is done using the
npm install
command:
$ npm install secret-santa-draw
How to use
Example of shuffle()
:
import {shuffle} from "secret-santa-draw";
const array = ["Kevin", "Sara", "John", "Jane", "Bob"];
const shuffledIndices = shuffle(array.length - 1);
const shuffledArray: string[] = [];
for (let i = 0; i < array.length; i++) {
const shuffledIndex = shuffledIndices[i];
shuffledArray[i] = array[shuffledIndex];
}
Example of draw()
:
import {draw} from "secret-santa-draw";
const array = ["Kevin", "Sara", "John", "Jane", "Bob"];
const shuffledArray = draw(array);