# interpolate-util

> Usefull utility functions for interpolating values from ranges

Latest version **2.0.0** (published 2022-05-13) · MIT license · 107 weekly downloads

## Install

```sh
npm install interpolate-util
pnpm add interpolate-util
yarn add interpolate-util
bun add interpolate-util
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-05-13 |
| First published | 2022-05-12 |
| Weekly downloads | 107 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 20.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shmuel Leider |
| Maintainers | sammyl |
| Keywords | interpolation, utility, range |

## Links

- npm: https://www.npmjs.com/package/interpolate-util
- Repository: https://github.com/sammyl720/interpolation-utilities
- Issues: https://github.com/sammyl720/interpolation-utilities/issues
- npm.io page: https://npm.io/package/interpolate-util

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^4.6.4

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-05-13
- 1.0.4 — 2022-05-12
- 1.0.3 — 2022-05-12
- 1.0.1 — 2022-05-12
- 1.0.0 — 2022-05-12

## README

### Useful functions for interpolating values from ranges

----
##### getValueAtPercentagePoint(rangeMin, rangeMax, percentagePoint)
Get a value at a percentage point in a range
```javascript
getValueAtPercentagePoint(5, 30, 0.5); // 17.5
```

---
##### getPercentageFromValue(rangeMin, rangeMax, value)
Get a percentage from a value in a range
```javascript
getPercentageFromValue(5, 30, 17.5); // 0.5
```


---
##### clamp(value, min, max)
Clamp a value between a minimum and maximum
```javascript
clamp(5, 0, 10); // 5
clamp(15, 0, 10); // 10
clamp(5, 10, 20); // 10
```

---
##### interpolateValue(rangeAMin, rangeAMax, value, rangeBMin, rangeBMax)
Interpolate a value between two ranges
```javascript
interpolateValue(0, 100, 50, 0, 1); // 0.5
interpolateValue(0, 250, 50, 0, 100); // 20
```

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