mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-05 06:57:35 -04:00
fix notes inside object
This commit is contained in:
@@ -114,6 +114,9 @@ describe('dirtify', () => {
|
||||
assert.deepStrictEqual(dirtify({ n: 7 }), { n: 7 });
|
||||
assert.deepStrictEqual(dirtify({ n: 7, room: 0.5 }), { n: 7, room: 0.5 });
|
||||
});
|
||||
it('should parse notes inside object', () => {
|
||||
assert.deepStrictEqual(dirtify({ n: 'c3', s: 'supersaw' }), { n: -12, s: 'supersaw' });
|
||||
});
|
||||
it('should dirtify .value', () => {
|
||||
assert.deepStrictEqual(dirtify({ value: 61 }), { n: 1 });
|
||||
assert.deepStrictEqual(dirtify({ value: 'c5' }), { n: 12 });
|
||||
|
||||
@@ -96,8 +96,9 @@ export function objectify(value) {
|
||||
// turns value into object that is the right format superdirt osc
|
||||
export function dirtify(val) {
|
||||
const obj = objectify(val);
|
||||
|
||||
if (obj.n && typeof obj.n === 'string') {
|
||||
return { ...obj, ...objectify(obj.n) };
|
||||
return { ...obj, ...dirtify(obj.n) };
|
||||
}
|
||||
const { value, ...rest } = obj;
|
||||
if (typeof value === 'undefined') {
|
||||
|
||||
Reference in New Issue
Block a user