Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
eefano committed Feb 25, 2024
1 parent af062f9 commit 1550bf4
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions packages/core/muxers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ This program is free software: you can redistribute it and/or modify it under th

import { Pattern, register } from './pattern.mjs';


/** * Picks patterns (or plain values) either from a list (by index) or a lookup table (by name).
* Similar to `inhabit`, but maintains the structure of the original patterns.
* @param {Pattern} pat
Expand All @@ -23,15 +22,15 @@ import { Pattern, register } from './pattern.mjs';
*/

export const pick = function (lookup, pat) {
// backward compatibility - the args used to be flipped
if (Array.isArray(pat)) {
// backward compatibility - the args used to be flipped
if (Array.isArray(pat)) {
[pat, lookup] = [lookup, pat];
}
return __pick(lookup, pat);
}
return __pick(lookup, pat);
};

const __pick = register('pick', function (lookup, pat) {
return pat.mux.in(lookup);
return pat.mux.in(lookup);
});

/** * The same as `pick`, but if you pick a number greater than the size of the list,
Expand All @@ -44,7 +43,7 @@ return pat.mux.in(lookup);
*/

export const pickmod = register('pickmod', function (lookup, pat) {
return pat.muxm.in(lookup);
return pat.muxm.in(lookup);
});

/** * pickF lets you use a pattern of numbers to pick which function to apply to another pattern.
Expand All @@ -59,7 +58,7 @@ return pat.muxm.in(lookup);
* .pickF("<0 2> 1", [jux(rev),fast(2),x=>x.lpf(800)])
*/
export const pickF = register('pickF', function (lookup, funcs, pat) {
return pat.apply(pick(lookup, funcs));
return pat.apply(pick(lookup, funcs));
});

/** * The same as `pickF`, but if you pick a number greater than the size of the functions list,
Expand All @@ -70,7 +69,7 @@ return pat.apply(pick(lookup, funcs));
* @returns {Pattern}
*/
export const pickmodF = register('pickmodF', function (lookup, funcs, pat) {
return pat.apply(pickmod(lookup, funcs));
return pat.apply(pickmod(lookup, funcs));
});

/** * Similar to `pick`, but it applies an outerJoin instead of an innerJoin.
Expand All @@ -79,7 +78,7 @@ return pat.apply(pickmod(lookup, funcs));
* @returns {Pattern}
*/
export const pickOuter = register('pickOuter', function (lookup, pat) {
return pat.mux.out(lookup);
return pat.mux.out(lookup);
});

/** * The same as `pickOuter`, but if you pick a number greater than the size of the list,
Expand All @@ -89,7 +88,7 @@ return pat.mux.out(lookup);
* @returns {Pattern}
*/
export const pickmodOuter = register('pickmodOuter', function (lookup, pat) {
return pat.muxm.out(lookup);
return pat.muxm.out(lookup);
});

/** * Similar to `pick`, but the choosen pattern is restarted when its index is triggered.
Expand All @@ -98,7 +97,7 @@ return pat.muxm.out(lookup);
* @returns {Pattern}
*/
export const pickRestart = register('pickRestart', function (lookup, pat) {
return pat.mux.trigzero(lookup);
return pat.mux.trigzero(lookup);
});

/** * The same as `pickRestart`, but if you pick a number greater than the size of the list,
Expand All @@ -108,7 +107,7 @@ return pat.mux.trigzero(lookup);
* @returns {Pattern}
*/
export const pickmodRestart = register('pickmodRestart', function (lookup, pat) {
return pat.muxm.trigzero(lookup);
return pat.muxm.trigzero(lookup);
});

/** * Similar to `pick`, but the choosen pattern is reset when its index is triggered.
Expand All @@ -117,7 +116,7 @@ return pat.muxm.trigzero(lookup);
* @returns {Pattern}
*/
export const pickReset = register('pickReset', function (lookup, pat) {
return pat.mux.trig(lookup);
return pat.mux.trig(lookup);
});

/** * The same as `pickReset`, but if you pick a number greater than the size of the list,
Expand All @@ -127,7 +126,7 @@ return pat.mux.trig(lookup);
* @returns {Pattern}
*/
export const pickmodReset = register('pickmodReset', function (lookup, pat) {
return pat.muxm.trig(lookup);
return pat.muxm.trig(lookup);
});

/**
Expand All @@ -144,7 +143,7 @@ return pat.muxm.trig(lookup);
* s("a@2 [a b] a".inhabit({a: "bd(3,8)", b: "sd sd"})).slow(4)
*/
export const inhabit = register('inhabit', function (lookup, pat) {
return pat.mux.squeeze(lookup);
return pat.mux.squeeze(lookup);
});

/** * The same as `inhabit`, but if you pick a number greater than the size of the list,
Expand All @@ -157,6 +156,5 @@ return pat.mux.squeeze(lookup);
*/

export const inhabitmod = register('inhabitmod', function (lookup, pat) {
return pat.muxm.squeeze(lookup);
return pat.muxm.squeeze(lookup);
});

0 comments on commit 1550bf4

Please # to comment.