Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @mishguru/interpolate with all npm packages installed. Try it out:

var interpolate = require("@mishguru/interpolate")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@mishguru/interpolate v0.1.0

Estimates where data should lie by interpolating through a list of points

interpolate

Interpolate takes a list of points and finds the best guess of where data would lie given the mean of the Y value using a 'best guess' method.

Interpolate works by taking your points, parsing them from the right, and finding the first place where the average Y fits between two points. It is really only useful for very specific circumstances although Pull Requests are welcome if you would like to see this functionality extended.

Installation

npm install @mishguru/interpolate

Usage

The best way to figure out how to use this library is to look at src/index.spec.js file.

import interpolate from '@mishguru/interpolate'

const points = [{ x: 1, y: 2 }, { x: 3, y: 4 }]
const result = interpolate(points)
result.x === 2 //true
result.y === 3
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free