jammi

1.0.2 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i jammi

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • m31271n_account