# json-balancer

> Generates JSON object from balance configuration

Latest version **0.5.0** (published 2015-09-04) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install json-balancer
pnpm add json-balancer
yarn add json-balancer
bun add json-balancer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2015-09-04 |
| First published | 2015-09-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Lucas Reis |
| Maintainers | lucasmreis |
| Keywords | json, generation, balance, random, validation |

## Links

- npm: https://www.npmjs.com/package/json-balancer
- Repository: https://github.com/lucasmreis/json-balancer
- Homepage: https://github.com/lucasmreis/json-balancer#readme
- Issues: https://github.com/lucasmreis/json-balancer/issues
- npm.io page: https://npm.io/package/json-balancer

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.5.0 (latest) — 2015-09-04
- 0.4.0 — 2015-09-04
- 0.3.0 — 2015-09-04
- 0.2.0 — 2015-09-04
- 0.1.0 — 2015-09-04

## README

# json-balancer
Generates JSON object from balance configuration.

Example:
```javascript
import {validate, generate, generateDefault} from 'json-balancer';

const config = {
  a: 123,
  b: 456,
  c: {
    balance: [
      {percent: 10, value: 'one value'},
      {percent: 70, value: 'another value', defaultValue: true},
      {percent: 20, value: 'and another'}
    ]
  },
  d: 789
};

validate(config);
// => true

generateDefault(config);
// => {
//      a: 123,
//      b: 456,
//      c: 'another value',
//      d: 789
//    }

generate(config);
// => {
//      a: 123,
//      b: 456,
//      c: random value chosen from the weighted options
//      d: 789
//    }

```

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