Skip to content

interpolate

Subhajit Sahu edited this page May 19, 2020 · 12 revisions

Estimates new values between existing ones. 🏃 📼 📦 🌔 📒

Similar: interleave, intermix, intersperse, interpolate.

array.interpolate(x, fn);
// x:  an array
// fn: combine function (a, b)
const array = require('extra-array');

var x = [1, 2, 3];
array.interpolate(x, (a, b) => (a + b)/2);
// [ 1, 1.5, 2, 2.5, 3 ]
Clone this wiki locally