Skip to content
This repository has been archived by the owner on Aug 28, 2020. It is now read-only.

dodrio/jammi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jammi

Standard - JavaScript Style Guide Dependency Status DevDependency Status NPM Downloads Travis Build Status

Simple solutions of lucky draw.

Install

$ npm install jammi

API

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.


Made with ❤ by m31271n