Created
April 25, 2022 18:48
-
-
Save ciju/30d0fe5da990ae4e15662ec07cd50fb9 to your computer and use it in GitHub Desktop.
Revisions
-
ciju created this gist
Apr 25, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ 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;