brak() fix

This commit is contained in:
alex 2022-05-09 17:24:49 +02:00
parent 4fd843f8cf
commit a8d676641b

View file

@ -67,7 +67,7 @@ export class Pattern {
* @param {Function} func the function to apply
* @returns Pattern
*/
withQueryTime(func) {
withQueryTime(func) {
return new Pattern((state) => this.query(state.withSpan((span) => span.withTime(func))));
}
@ -88,7 +88,7 @@ export class Pattern {
* @param {Function} func the function to apply
* @returns Pattern
*/
withHapTime(func) {
withHapTime(func) {
return this.withHapSpan((span) => span.withTime(func));
}
@ -97,7 +97,7 @@ export class Pattern {
* @param {Function} func
* @returns Pattern
*/
_withHaps(func) {
_withHaps(func) {
return new Pattern((state) => func(this.query(state)));
}
@ -106,7 +106,7 @@ export class Pattern {
* @param {Function} func
* @returns Pattern
*/
_withHap(func) {
_withHap(func) {
return this._withHaps((haps) => haps.map(func));
}
@ -193,7 +193,7 @@ export class Pattern {
/**
* see {@link Pattern#withValue|withValue}
*/
fmap(func) {
fmap(func) {
return this.withValue(func);
}
@ -231,7 +231,7 @@ export class Pattern {
* as its `part` timespan.
* @returns Pattern
*/
onsetsOnly() {
onsetsOnly() {
// Returns a new pattern that will only return haps where the start
// of the 'whole' timespan matches the start of the 'part'
// timespan, i.e. the haps that include their 'onset'.
@ -829,7 +829,7 @@ export class Pattern {
* @returns Pattern
*/
brak() {
return this.every(2, x => fastcat(x, silence)._late(0.25))
return this.when(slowcat(false, true), (x) => fastcat(x, silence)._late(0.25));
}
rev() {
@ -989,7 +989,7 @@ function _composeOp(a, b, func) {
}
// Make composers
(function() {
(function () {
const num = (pat) => pat._asNumber();
const numOrString = (pat) => pat._asNumber(false, true);