Nutritious Pumpkin Mash

    simple-gift-exchange

    1.0.7 • Public • Published

    simple-gift-exchange

    example workflow NPM version NPM downloads LICENSE

    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
    1. one can not receive a gift from the same person to whom they give a gift
    2. 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
    

    License

    MIT

    Keywords

    none

    Install

    npm i simple-gift-exchange

    DownloadsWeekly Downloads

    0

    Version

    1.0.7

    License

    MIT

    Unpacked Size

    5.44 kB

    Total Files

    4

    Last publish

    Collaborators

    • wilmoore