npm run format:write

This commit is contained in:
2024-10-14 21:35:16 -05:00
parent 713fdc8959
commit b3dc125df3
2 changed files with 26 additions and 26 deletions
+13 -13
View File
@@ -37,23 +37,23 @@ export function messageToBuffer(message: OSCMessage): Uint8Array {
throw new Error('problem encoding address'); throw new Error('problem encoding address');
} }
let typeString = ',' let typeString = ',';
const flatOSCArgs: OSCArg[] = [] const flatOSCArgs: OSCArg[] = [];
message.args.forEach((oscArg) => { message.args.forEach((oscArg) => {
if (Array.isArray(oscArg)) { if (Array.isArray(oscArg)) {
typeString += '[' typeString += '[';
oscArg.forEach((oscArg) => { oscArg.forEach((oscArg) => {
typeString += oscArg.type typeString += oscArg.type;
flatOSCArgs.push(oscArg) flatOSCArgs.push(oscArg);
}) });
typeString += ']' typeString += ']';
} else { } else {
typeString += oscArg.type typeString += oscArg.type;
flatOSCArgs.push(oscArg) flatOSCArgs.push(oscArg);
} }
}) });
const typesBuffer = oscTypeConverterMap.s.toBuffer(typeString); const typesBuffer = oscTypeConverterMap.s.toBuffer(typeString);
if (typesBuffer === undefined) { if (typesBuffer === undefined) {
@@ -89,7 +89,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
if (argType === '[') { if (argType === '[') {
if (insideArgArray) { if (insideArgArray) {
throw new Error('osc arg array opened without closing previous arg array') throw new Error('osc arg array opened without closing previous arg array');
} }
oscArrayArg = []; oscArrayArg = [];
insideArgArray = true; insideArgArray = true;
@@ -98,7 +98,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
if (argType === ']') { if (argType === ']') {
if (!insideArgArray) { if (!insideArgArray) {
throw new Error('osc arg array closed without opening arg array') throw new Error('osc arg array closed without opening arg array');
} }
oscArgs.push(oscArrayArg); oscArgs.push(oscArrayArg);
oscArrayArg = []; oscArrayArg = [];
@@ -117,7 +117,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
value: value, value: value,
}; };
if (insideArgArray) { if (insideArgArray) {
oscArrayArg.push(arg) oscArrayArg.push(arg);
} else { } else {
oscArgs.push(arg); oscArgs.push(arg);
} }
+1 -1
View File
@@ -138,7 +138,7 @@ const badTests = [
name: /^Error$/, name: /^Error$/,
message: 'osc message must start with a /', message: 'osc message must start with a /',
}, },
} },
]; ];
describe('OSC Message Encoding', () => { describe('OSC Message Encoding', () => {