UNPKG

@extra-array/interpolate

Version:

Estimates new values between existing ones.

12 lines (11 loc) 220 B
'use strict'; function interpolate(x, fc) { var a = [], u, i = -1; for (var v of x) { if (++i > 0) a.push(fc(u, v)); a.push(u = v); } return a; } module.exports = interpolate;