Skip to content

Instantly share code, notes, and snippets.

@ciju
Created Apr 25, 2022
Embed
What would you like to do?
const blur1 = (data) =>
data.map((d, i) => {
const previous = i === 0 ? i : i - 1;
const next = i === data.length - 1 ? i : i + 1;
const sum = (data[previous] || 0) + d + (data[next] || 0);
d = sum / 3;
return d;
});
const twice = (fn) => (x) => fn(fn(x));
const fourTimes = (fn) => twice(twice(fn));
const sixtyfourTimes = (fn) => fourTimes(fourTimes(fn));
const blur = (x) => sixtyfourTimes(blur1)(x);
export default blur;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment