range-map
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/range-map package

1.0.4 • Public • Published

range-map

inspired by the Map function in Processing. This module scales a number from one range to another

Build Status codecov

Installation

$ npm install range-map

Example Usage

var rangeMap = require('range-map')
 
var mapped = rangeMap(50, 0, 100, 0, 1000)
 
//mapped == 500

API

mapped(input, inputLowest, inputHighest, outputLowest, outputHighest)

returns a number that has been rounded with Math.round() The ranges will also work with negative numbers.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    13
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    13
  • 1.0.3
    0
  • 1.0.2
    1
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i range-map

Weekly Downloads

13

Version

1.0.4

License

ISC

Last publish

Collaborators

  • ashleymarkfletcher