# evenly

> How to divide the gold evenly ?

Latest version **1.0.2** (published 2017-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install evenly
pnpm add evenly
yarn add evenly
bun add evenly
```

## 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.0.2 |
| Published | 2017-03-02 |
| First published | 2017-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | hustcc |
| Maintainers | atool |
| Keywords | evenly, divide, average, robber, gold |

## Links

- npm: https://www.npmjs.com/package/evenly
- Repository: https://github.com/hustcc/evenly
- Homepage: https://github.com/hustcc/evenly#readme
- Issues: https://github.com/hustcc/evenly/issues
- npm.io page: https://npm.io/package/evenly

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2017-03-02
- 1.0.1 — 2017-02-27
- 1.0.0 — 2017-02-27
- 0.0.1 — 2017-02-27

## README

# evenly

> **evenly** is a simple javascript library to solve problem which is similar to **how to divide the gold evenly?**

**Q**: How **3 robbers** to divide **100 gold**?

**A**: 100 / 3 can not solve it. But evenly can, **`evenly(100, 3)`** can get `[33.34, 33.33, 33.33]`. Done ^_^.

[![Build Status](https://travis-ci.org/hustcc/evenly.svg?branch=master)](https://travis-ci.org/hustcc/evenly) [![npm](https://img.shields.io/npm/v/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly) [![npm](https://img.shields.io/npm/dt/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly) [![npm](https://img.shields.io/npm/l/evenly.svg?style=flat-square)](https://www.npmjs.com/package/evenly)


# 1. Install

> **npm install evenly**

Then import it.

```js
var evenly = require('evenly');
//or
import evenly from 'evenly';
```

Then use **evenly(gold, robber, fixed=2)** API.

```js
// 3 robber divide 100 golds, with 2 decimal.
evenly(100, 3, 1); // will return [33.4, 33.3, 33.3];

evenly(100, 6); // will return [16.67, 16.67, 16.67, 16.67, 16.66, 16.66];
```


# 2. API

The unique API is: **evenly(gold, robber, fixed=2)**.

 - **gold** (Number): the number of gold.
 - **robber** (Number): the number of robber who will divide the gold.
 - **fixed** (Number): the decimal length, default is `2`.

The api return the array which shows how to divide the gold evenly.


# 3. Build & Test

> npm install

> npm run build

> npm test


# 4. LICENSE

MIT @[hustcc](https://github.com/hustcc)

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