simple-gift-exchange
v1.0.7
Published
[![example workflow](https://github.com/wilmoore/simple-gift-exchange/actions/workflows/node.js.yml/badge.svg)](https://github.com/wilmoore/simple-gift-exchange/actions/workflows/node.js.yml) [![NPM version](http://img.shields.io/npm/v/simple-gift-exchang
Downloads
7
Readme
simple-gift-exchange
Simple JavaScript API to create a randomized gift exchange list given a list of at least 3 participants
$ npm install simple-gift-exchange --save
API Usage Example
see
example.js
for further detail
const { giftlist } = require('simple-gift-exchange')
const exchange = giftlist(['Susan', 'Beth', 'Abe', 'Ardi', 'Quan'])
console.log(exchange)
[
[ 'Susan', 'Beth' ],
[ 'Beth', 'Quan' ],
[ 'Quan', 'Ardi' ],
[ 'Ardi', 'Abe' ],
[ 'Abe', 'Susan' ]
]
How It Works
A library for automating the creation of a gift exchange list where each member of the group has to both give and receive a gift randomly from among the others.
rules
- one can not receive a gift from the same person to whom they give a gift
- one can not receive a gift from self
example input:
['Susan', 'Beth', 'Abe', 'Ardi', 'Quan']
example output:
Abe gives a gift to Quan
Ardi gives a gift to Beth
Susan gives a gift to Abe
Quan gives a gift to Ardi
Beth gives a gift to Susan
Testing
npm test