UNPKG

@beenotung/tslib

Version:
22 lines (21 loc) 523 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createAlphaSmoother = createAlphaSmoother; function createAlphaSmoother(alpha) { const beta = 1 - alpha; let acc; const res = { next: init, }; function init(c) { acc = c; res.next = next; return c; } function next(c) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion acc = acc * alpha + c * beta; return acc; } return res; }