# rate-map

> Map a number in the range of 0-1 to a new value with a given range

Latest version **1.0.5** (published 2019-07-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install rate-map
pnpm add rate-map
yarn add rate-map
bun add rate-map
```

## 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.5 |
| Published | 2019-07-09 |
| First published | 2017-04-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | number, rate, percent, percentage, range, map, convert, min, max, math |

## Links

- npm: https://www.npmjs.com/package/rate-map
- Repository: https://github.com/shinnn/rate-map
- Homepage: https://github.com/shinnn/rate-map#readme
- Issues: https://github.com/shinnn/rate-map/issues
- npm.io page: https://npm.io/package/rate-map

## Dependencies (2)

- [terser](https://npm.io/package/terser.md) ^4.1.2
- [append-type](https://npm.io/package/append-type.md) ^1.0.1

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2019-07-09
- 1.0.2 — 2018-10-12
- 1.0.1 — 2018-03-26
- 1.0.0 — 2017-04-25
- 0.0.0 — 2017-04-25

## README

# rate-map

[![npm version](https://img.shields.io/npm/v/rate-map.svg)](https://www.npmjs.com/package/rate-map)
[![Build Status](https://travis-ci.org/shinnn/rate-map.svg?branch=master)](https://travis-ci.org/shinnn/rate-map)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/rate-map.svg)](https://coveralls.io/github/shinnn/rate-map)

Map a number in the range of `0`-`1` to a new value with a given range

```javascript
import rateMap from 'rate-map';

rateMap(0.5, 0, 100); //=> 50
rateMap(0.5, 100, 200); //=> 150
rateMap(0.5, -100, 100); //=> 0
```

## Installation

[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).

```
npm install rate-map
```

## API

### rateMap(*value*, *start*, *end*)

*value*: `number` in the range of `0..1`  
*start*: `number`  
*end*: `number`  
Return: `number`

```javascript
rateMap(0.1, 0, -1); //=> -0.1
rateMap(0.1, 1, -1); //=> -0.8
rateMap(0.1, -1, -2); //=> -1.1

rateMap(0, 5, 5); //=> 5
rateMap(0.5, 5, 5); //=> 5
rateMap(1, 5, 5); //=> 5
```

## License

[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe

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