<commit_before># rescale

[![Build Status](https://travis-ci.org/javiercejudo/rescale.svg)](https://travis-ci.org/javiercejudo/rescale)
[![Coverage Status](https://coveralls.io/repos/javiercejudo/rescale/badge.svg?branch=master)](https://coveralls.io/r/javiercejudo/rescale?branch=master)
[![Code Climate](https://codeclimate.com/github/javiercejudo/rescale/badges/gpa.svg)](https://codeclimate.com/github/javiercejudo/rescale)

Rescale data

## Install

    npm i rescale

## Usage

```js
var Decimal = require('linear-arbitrary-precision')(require('floating-adapter'));
var rescale = require('rescale')(Decimal).rescale;

rescale(-1, [-3, 5], [10, 20]); // => Decimal 12.5
rescale(40, [0, 100], [32, 212]); // => Decimal 104
```

See [spec](test/spec.js).

## Related projects

- [linear-converter](https://github.com/javiercejudo/linear-converter): flexible linear converter with built in conversions for common units.
- [scale](https://github.com/javiercejudo/scale): scales normalised data.
- [normalise](https://github.com/javiercejudo/normalise): normalise data to [0, 1].
- [rescale-util](https://github.com/javiercejudo/rescale-util): rescale utilities.<commit_msg>docs: fix argument order in example<commit_after># rescale

[![Build Status](https://travis-ci.org/javiercejudo/rescale.svg)](https://travis-ci.org/javiercejudo/rescale)
[![Coverage Status](https://coveralls.io/repos/javiercejudo/rescale/badge.svg?branch=master)](https://coveralls.io/r/javiercejudo/rescale?branch=master)
[![Code Climate](https://codeclimate.com/github/javiercejudo/rescale/badges/gpa.svg)](https://codeclimate.com/github/javiercejudo/rescale)

Rescale data

## Install

    npm i rescale

## Usage

```js
var Decimal = require('linear-arbitrary-precision')(require('floating-adapter'));
var rescale = require('rescale')(Decimal).rescale;

rescale([-3, 5], [10, 20], -1); // => Decimal 12.5
rescale([0, 100], [32, 212], 40); // => Decimal 104
```

See [spec](test/spec.js).

## Related projects

- [linear-converter](https://github.com/javiercejudo/linear-converter): flexible linear converter with built in conversions for common units.
- [scale](https://github.com/javiercejudo/scale): scales normalised data.
- [normalise](https://github.com/javiercejudo/normalise): normalise data to [0, 1].
- [rescale-util](https://github.com/javiercejudo/rescale-util): rescale utilities.
{'fraction_non_alphanumeric': 0.18438818565400844, 'fraction_numerical': 0.021940928270042195, 'mean_word_length': 5.513736263736264, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 20, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3536607', 'n_tokens_mistral': 897, 'n_tokens_neox': 827, 'n_words': 132}