simple-gift-exchange
v1.0.7
Published
[](https://github.com/wilmoore/simple-gift-exchange/actions/workflows/node.js.yml) [
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 SusanTesting
npm test