mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
actually apply the function in every
This commit is contained in:
parent
e12bcea613
commit
d3f4dcacff
@ -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) {
|
||||
|
||||
@ -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
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user