mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 06:19:33 -04:00
actually apply the function in every
This commit is contained in:
@@ -338,7 +338,7 @@ class Pattern {
|
||||
}
|
||||
every(n, func) {
|
||||
var pats = Array(n - 1).fill(this);
|
||||
pats.unshift(this);
|
||||
pats.unshift(func(this));
|
||||
return slowcat(...pats);
|
||||
}
|
||||
append(other) {
|
||||
|
||||
+1
-1
@@ -484,7 +484,7 @@ class Pattern {
|
||||
|
||||
every(n, func) {
|
||||
var pats = Array(n-1).fill(this)
|
||||
pats.unshift(this)
|
||||
pats.unshift(func(this))
|
||||
return slowcat(...pats)
|
||||
}
|
||||
|
||||
|
||||
@@ -163,12 +163,12 @@ describe('Pattern', function() {
|
||||
// )
|
||||
// })
|
||||
// })
|
||||
// describe('every()', () => {
|
||||
// it('Can apply a function every 3rd time', () => {
|
||||
// assert.deepStrictEqual(
|
||||
// pure("a").every(3, x => x._fast(2)._fast(3)).firstCycle,
|
||||
// sequence(sequence("a", "a"), "a", "a").firstCycle
|
||||
// )
|
||||
// })
|
||||
// })
|
||||
describe('every()', () => {
|
||||
it('Can apply a function every 3rd time', () => {
|
||||
assert.deepStrictEqual(
|
||||
pure("a").every(3, x => x._fast(2))._fast(3).firstCycle,
|
||||
sequence(sequence("a", "a"), "a", "a").firstCycle
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user