consume n with scale

This commit is contained in:
Felix Roos 2023-10-07 15:40:08 +02:00
parent e2569ed6dd
commit b297888eb4

View File

@ -150,6 +150,9 @@ export const scale = register('scale', function (scale, pat) {
return pat.withHap((hap) => {
const isObject = typeof hap.value === 'object';
let note = isObject ? hap.value.n : hap.value;
if (isObject) {
delete hap.value.n; // remove n so it won't cause trouble
}
const asNumber = Number(note);
if (!isNaN(asNumber)) {
// TODO: worth keeping for supporting ':' in (non-mininotation) strings?