From 89ee94e9533fee860f94d882af9623358c1fee6b Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 8 Feb 2022 12:41:01 +0000 Subject: [PATCH] tidy --- strudel.mjs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/strudel.mjs b/strudel.mjs index c921286c..cd1656a0 100644 --- a/strudel.mjs +++ b/strudel.mjs @@ -1,13 +1,9 @@ import Fraction from 'fraction.js' -const removeUndefineds = function(xs) { - // Removes 'None' values from given list - return xs.filter(x => x != undefined) -} +// Removes 'None' values from given list +const removeUndefineds = xs => xs.filter(x => x != undefined) -function flatten(arr) { - return [].concat(...arr) -} +const flatten = arr => [].concat(...arr) const id = a => a @@ -329,7 +325,7 @@ class Pattern { const pat_func = this const query = function(span) { - let haps = [] + const haps = [] for (const hap_val of pat_val.query(span)) { const hap_funcs = pat_func.query(hap_val.part) for (const hap_func of hap_funcs) { @@ -547,9 +543,7 @@ function reify(thing) { function stack(...pats) { const reified = pats.map(pat => reify(pat)) - const query = function(span) { - return flatten(reified.map(pat => pat.query(span))) - } + const query = span => flatten(reified.map(pat => pat.query(span))) return new Pattern(query) }