mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 21:18:49 +00:00
tidy
This commit is contained in:
parent
44336efb8d
commit
89ee94e953
16
strudel.mjs
16
strudel.mjs
@ -1,13 +1,9 @@
|
|||||||
import Fraction from 'fraction.js'
|
import Fraction from 'fraction.js'
|
||||||
|
|
||||||
const removeUndefineds = function(xs) {
|
// Removes 'None' values from given list
|
||||||
// Removes 'None' values from given list
|
const removeUndefineds = xs => xs.filter(x => x != undefined)
|
||||||
return xs.filter(x => x != undefined)
|
|
||||||
}
|
|
||||||
|
|
||||||
function flatten(arr) {
|
const flatten = arr => [].concat(...arr)
|
||||||
return [].concat(...arr)
|
|
||||||
}
|
|
||||||
|
|
||||||
const id = a => a
|
const id = a => a
|
||||||
|
|
||||||
@ -329,7 +325,7 @@ class Pattern {
|
|||||||
const pat_func = this
|
const pat_func = this
|
||||||
|
|
||||||
const query = function(span) {
|
const query = function(span) {
|
||||||
let haps = []
|
const haps = []
|
||||||
for (const hap_val of pat_val.query(span)) {
|
for (const hap_val of pat_val.query(span)) {
|
||||||
const hap_funcs = pat_func.query(hap_val.part)
|
const hap_funcs = pat_func.query(hap_val.part)
|
||||||
for (const hap_func of hap_funcs) {
|
for (const hap_func of hap_funcs) {
|
||||||
@ -547,9 +543,7 @@ function reify(thing) {
|
|||||||
|
|
||||||
function stack(...pats) {
|
function stack(...pats) {
|
||||||
const reified = pats.map(pat => reify(pat))
|
const reified = pats.map(pat => reify(pat))
|
||||||
const query = function(span) {
|
const query = span => flatten(reified.map(pat => pat.query(span)))
|
||||||
return flatten(reified.map(pat => pat.query(span)))
|
|
||||||
}
|
|
||||||
return new Pattern(query)
|
return new Pattern(query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user