Tidy test and console logs
This commit is contained in:
parent
b370c405da
commit
3ae6443c59
2 changed files with 3 additions and 19 deletions
|
|
@ -714,21 +714,6 @@ export class Pattern {
|
||||||
_velocity(velocity) {
|
_velocity(velocity) {
|
||||||
return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity }));
|
return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity }));
|
||||||
}
|
}
|
||||||
|
|
||||||
add(other) {
|
|
||||||
return this._asNumber()._opLeft(other, (a) => (b) => a + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub(other) {
|
|
||||||
return this._asNumber()._opLeft(other, (a) => (b) => a - b);
|
|
||||||
}
|
|
||||||
mul(other) {
|
|
||||||
return this._asNumber()._opLeft(other, (a) => (b) => a * b);
|
|
||||||
}
|
|
||||||
|
|
||||||
div(other) {
|
|
||||||
return this._asNumber()._opLeft(other, (a) => (b) => a / b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// pattern composers
|
// pattern composers
|
||||||
|
|
@ -741,7 +726,6 @@ const composers = {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const [name, op] of Object.entries(composers)) {
|
for (const [name, op] of Object.entries(composers)) {
|
||||||
console.log(`Adding ${name}`);
|
|
||||||
Pattern.prototype[name] = function (other) {
|
Pattern.prototype[name] = function (other) {
|
||||||
return op[1](this)._opLeft(other, op[0]);
|
return op[1](this)._opLeft(other, op[0]);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -161,11 +161,11 @@ describe('Pattern', function () {
|
||||||
assert.equal(pure(3).div(pure(2)).firstCycle()[0].value, 1.5);
|
assert.equal(pure(3).div(pure(2)).firstCycle()[0].value, 1.5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('union()', function () {
|
describe('set()', function () {
|
||||||
it('Can union things', function () {
|
it('Can set things', function () {
|
||||||
assert.deepStrictEqual(
|
assert.deepStrictEqual(
|
||||||
pure({ a: 4, b: 6 })
|
pure({ a: 4, b: 6 })
|
||||||
.union(pure({ c: 7 }))
|
.set(pure({ c: 7 }))
|
||||||
.firstCycle()[0].value,
|
.firstCycle()[0].value,
|
||||||
{ a: 4, b: 6, c: 7 },
|
{ a: 4, b: 6, c: 7 },
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue