# ml-array-rescale

> Rescale an array into a range

Latest version **2.0.0** (published 2026-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install ml-array-rescale
pnpm add ml-array-rescale
yarn add ml-array-rescale
bun add ml-array-rescale
```

## Health

**Score 50/100 (C)** — status: active.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2026-04-14 |
| First published | 2017-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 3 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 16 |
| Author | Michaël Zasso |
| Maintainers | stropitek, targos, lpatiny, mljs-bot |

## Links

- npm: https://www.npmjs.com/package/ml-array-rescale
- Repository: https://github.com/mljs/array
- Homepage: https://github.com/mljs/array/tree/master/packages/array-rescale#readme
- Issues: https://github.com/mljs/array/issues
- npm.io page: https://npm.io/package/ml-array-rescale

## Dependencies (3)

- [is-any-array](https://npm.io/package/is-any-array.md) ^3.0.0
- [ml-array-max](https://npm.io/package/ml-array-max.md) ^2.0.0
- [ml-array-min](https://npm.io/package/ml-array-min.md) ^2.0.0

## Recent versions

- 2.0.0 (latest) — 2026-04-14
- 1.3.7 — 2022-01-21
- 1.3.6 — 2021-09-01
- 1.3.5 — 2021-03-24
- 1.3.4 — 2021-03-03
- 1.3.3 — 2021-02-23
- 1.3.2 — 2020-10-07
- 1.3.1 — 2020-04-17
- 1.3.0 — 2020-04-02
- 1.2.2 — 2019-08-30
- 1.2.1 — 2018-11-09
- 1.2.0 — 2018-10-26
- 1.1.1 — 2018-08-03
- 1.1.0 — 2017-07-18
- 1.0.2 — 2017-07-11
- … 2 more at https://npm.io/package/ml-array-rescale/versions

## README

# array-rescale

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]

Rescale an array into a range.

## Installation

`$ npm install --save ml-array-rescale`

## Usage

### `rescale(input[, options])`

Rescales the values in the `input` so they fit between two new values.

**Options:**

- `min`: the new minimum value (default: 0)
- `max`: the new maximum value (default: 1)
- `output`: an array to use for output. You can pass `input` here to get an in-place modification.

```js
import rescale from 'ml-array-rescale';

const result = rescale([0, 1, 2, 3, 4]);
// [0, 0.25, 0.5, 0.75, 1]
```

## License

[MIT](./LICENSE)

[npm-image]: https://img.shields.io/npm/v/ml-array-rescale.svg?style=flat-square
[npm-url]: https://npmjs.org/package/ml-array-rescale
[download-image]: https://img.shields.io/npm/dm/ml-array-rescale.svg?style=flat-square
[download-url]: https://npmjs.org/package/ml-array-rescale

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