1.0.2 • Published 8 years ago
jammi v1.0.2
jammi
Simple solutions of lucky draw.
Install
$ npm install jammiAPI
jammi.probability(prizes)
The most common method with setting probability.
- prizes:
[
{
id: '61f55251-3b9c-498e-bbbe-c730de62a38d' // id of prize
probability: 0.35 // probability of prize
}
...
]Return id or null.
jammi.pool(prizes)
Prize are threw into a imaginary pool. Every can get a prize when his / her hand reach the pool.
- prizes:
[
{
id: '61f55251-3b9c-498e-bbbe-c730de62a38d' // id of prize
balance: 124 // balance of prize
}
...
]Return id or null.
jammi.period (prizes, startTime, endTime)
Prizes are distributed on timeline between startTime to endTime. This method gains best effect of marketing.
prizes:
[
{
id: '61f55251-3b9c-498e-bbbe-c730de62a38d' // id of prize
sum: 200 // sum of prize, including those which have been issued
balance: 124 // balance of prize
}
...
]startTime: the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.endTime: the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
Return id or null.