mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-30 00:06:59 -04:00
add some module level curried aliases
This commit is contained in:
+19
-1
@@ -2,7 +2,7 @@ import Fraction from 'fraction.js'
|
||||
|
||||
import { strict as assert } from 'assert';
|
||||
|
||||
import {TimeSpan, Hap, Pattern, pure, stack, fastcat, slowcat, cat, sequence, polyrhythm, silence} from "../strudel.mjs";
|
||||
import {TimeSpan, Hap, Pattern, pure, stack, fastcat, slowcat, cat, sequence, polyrhythm, silence, fast} from "../strudel.mjs";
|
||||
|
||||
const ts = (begin, end) => new TimeSpan(Fraction(begin), Fraction(end));
|
||||
const hap = (whole, part, value) => new Hap(whole, part, value)
|
||||
@@ -104,6 +104,18 @@ describe('Pattern', function() {
|
||||
sequence(1,2,3).fast(1.5,2).firstCycle
|
||||
)
|
||||
})
|
||||
it("works as a static function", function () {
|
||||
assert.deepStrictEqual(
|
||||
sequence(1,2,3).fast(1,2).firstCycle,
|
||||
fast(sequence(1,2), sequence(1,2,3)).firstCycle
|
||||
)
|
||||
})
|
||||
it("works as a curried static function", function () {
|
||||
assert.deepStrictEqual(
|
||||
sequence(1,2,3).fast(1,2).firstCycle,
|
||||
fast(sequence(1,2))(sequence(1,2,3)).firstCycle
|
||||
)
|
||||
})
|
||||
})
|
||||
describe('_slow()', function () {
|
||||
it('Makes things slower', function () {
|
||||
@@ -176,5 +188,11 @@ describe('Pattern', function() {
|
||||
sequence(sequence("a", "a"), "a", "a").firstCycle
|
||||
)
|
||||
})
|
||||
it("works with currying", () => {
|
||||
assert.deepStrictEqual(
|
||||
pure("a").every(3, fast(2))._fast(3).firstCycle,
|
||||
sequence(sequence("a", "a"), "a", "a").firstCycle
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user