# moti-make-heartbeat

> Create fake payload data for testing the Variable Speed Sign application.

Latest version **2.1.6** (published 2020-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install moti-make-heartbeat
pnpm add moti-make-heartbeat
yarn add moti-make-heartbeat
bun add moti-make-heartbeat
```

## 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 | 2.1.6 |
| Published | 2020-04-18 |
| First published | 2019-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jamie Popkin |
| Maintainers | popkinj |

## Links

- npm: https://www.npmjs.com/package/moti-make-heartbeat
- Repository: git@github.com/popkinj/moti-make-heartbeat
- npm.io page: https://npm.io/package/moti-make-heartbeat

## Dependencies (3)

- [moment](https://npm.io/package/moment.md) ^2.24.0
- [livescript](https://npm.io/package/livescript.md) ^1.6.0
- [moti-make-sign](https://npm.io/package/moti-make-sign.md) ^2.1.1

## Recent versions

- 2.1.6 (latest) — 2020-04-18
- 2.1.5 — 2020-04-18
- 2.1.4 — 2020-04-18
- 2.1.3 — 2020-04-18
- 2.1.2 — 2020-04-13
- 2.1.1 — 2020-04-13
- 2.1.0 — 2020-04-13
- 2.0.2 — 2020-03-29
- 2.0.1 — 2020-03-27
- 2.0.0 — 2020-03-24
- 1.0.4 — 2019-06-05
- 1.0.3 — 2019-06-05
- 1.0.2 — 2019-06-05
- 1.0.1 — 2019-06-04
- 1.0.0 — 2019-05-30

## README

# moti-make-heartbeat

The Variable Speed Sign application accepts *heartbeat* JSON payloads from trusted sources. This library produces fake data that can be used for testing.

## Installing
```
npm i moti-make-heartbeat
```

## Usage
There are three parameters to adjust.
1. numSigns - The number of signs
1. numCorridors - The number of corridors
1. historySize - The number of history records

The _numSigns_ are split evenly amoung all corridors specified within _numCorridors_. The historySize refers to the number of sign changes in the history array for each sign. Speeds within the history are random between 50 - 100. The timestamps within the history step back ten minutes per record from the current time.

```javascript
const request = require('request');
const makeHeartbeat = require('moti-make-heartbeat');

const options = {
  numSigns: 60,
  numCorridors: 3,
  historySize: 10
}

const heartbeat = makeHeartbeat.create.heartbeat(options);

request({
  url: "https://url.to.server",
  method: "POST",
  json: heartbeat
});
```

## Testing
Create a test heartbeat object and print to the console
```
cd moti-make-heartbeat
npm test
```

You can adjust the parameters in the _test/run.ls_ file.

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