# simple-gacha

> A very simple gacha function that picks an element based off a loot table

Latest version **1.1.2** (published 2020-07-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-gacha
pnpm add simple-gacha
yarn add simple-gacha
bun add simple-gacha
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2020-07-09 |
| First published | 2020-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | reaganiwadha |
| Maintainers | reaganiwadha |
| Keywords | gacha, rpg |

## Links

- npm: https://www.npmjs.com/package/simple-gacha
- Repository: https://github.com/reaganiwadha/simple-gacha
- Homepage: https://github.com/reaganiwadha/simple-gacha#readme
- Issues: https://github.com/reaganiwadha/simple-gacha/issues
- npm.io page: https://npm.io/package/simple-gacha

## Dependencies (2)

- [lodash.sum](https://npm.io/package/lodash.sum.md) ^4.0.2
- [lodash.random](https://npm.io/package/lodash.random.md) ^3.2.0

## Recent versions

- 1.1.2 (latest) — 2020-07-09
- 1.1.1 — 2020-07-03
- 1.1.0 — 2020-07-03
- 1.0.0 — 2020-07-03

## README

# simple-gacha
A very simple gacha function that picks an element based off a loot table.

## Example
```javascript
const gacha = require("simple-gacha");

const lootTable = [
    {
        "name" : "Golden Knife",
        "weight" : 10
    },
    {
        "name" : "Diamond Pickaxe",
        "weight" : 5
    },
    {
        "name" : "Invisibility Cap",
        "weight" : 2
    }
]

const { pick } = gacha.simple(lootTable);
console.log(pick);
```
Since `Golden Knife` has the biggest weight, there's a higher chance that it will return Golden Knife.
```json
{
    "name" : "Golden Knife",
    "weight" : 10
}
```

## Contributing
Pull requests are very welcomed. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

---
_Source: https://npm.io/package/simple-gacha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
