1.0.2 • Published 4 years ago

raffle-x v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

raflle-x

Raffle package.

Importing

const raffleX = require('raffle-x');

Parameters

(array, key, quantity, false)

PARAMETERVALUEOBS
arrayJSON arrayJSON array with values ​​to be raffles
keyarray keyKey of the field to be located
quantityquantity numberNumber of names raffles
duplicitytrue/falseIf the same die can be raffles more than once

Usage example

const names = [
    {
        "id": "111111",
        "name": "Name 1",
    },{
        "id": "222222",
        "name": "Name 2"
    },{
        "id": "333333",
        "name": "Name 3"
    
    },{
        "id": "444444",
        "name": "Name 4"
    },{
        "id": "444444",
        "name": "Name 5"
    }
];

rafflex.raffle(names, 'id', 6, false);

Return

returns a json object with the raffle values

[
  { id: '222222', name: 'Name 2' },
  { id: '444444', name: 'Name 4' },
  { id: '333333', name: 'Name 3' },
  { id: '111111', name: 'Name 1' }
]

Note

If you have any duplicate keys, raffle-x considers only the first one.

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago