@axetroy/roll
v1.0.2
Published
Roll item from a given list with simple api.
Downloads
23
Readme
Roll
Roll item from a given list with simple api.
Installation
npm install @axetroy/rollor if you are using yarn(recommend)
yarn add @axetroy/rollUsage
const Roll = require('@axetroy/roll');
const roller = new Roll();
roller.add('Apple', 1); // 10% get Apple
roller.add('Sydney', 2); // 20% get Sydney
roller.add('Banana', 7); // 70% get Banana
const result = roller.roll();
console.log(result);API
.add(item:any, rank: number): void
add an item to roller.
- item: any thing except undefined and null
- rank: rank of the item. you can set any number >0, no need the make them in 10 total.
.roll(): any
start roll and return item.
Test
git clone https://github.com/axetroy/roll.git
cd ./gpm.js
yarn
yarn run testContributing
git clone https://github.com/axetroy/roll.git
cd ./gpm.js
yarn
yarn run testYou can flow Contribute Guide
Contributors
| Axetroy💻 🔌 ⚠️ 🐛 🎨 | | :---: |
License
The MIT License
