mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-09-13 18:09:27 +00:00
npm run format:write
This commit is contained in:
+13
-13
@@ -37,23 +37,23 @@ export function messageToBuffer(message: OSCMessage): Uint8Array {
|
||||
throw new Error('problem encoding address');
|
||||
}
|
||||
|
||||
let typeString = ','
|
||||
let typeString = ',';
|
||||
|
||||
const flatOSCArgs: OSCArg[] = []
|
||||
const flatOSCArgs: OSCArg[] = [];
|
||||
|
||||
message.args.forEach((oscArg) => {
|
||||
if (Array.isArray(oscArg)) {
|
||||
typeString += '['
|
||||
typeString += '[';
|
||||
oscArg.forEach((oscArg) => {
|
||||
typeString += oscArg.type
|
||||
flatOSCArgs.push(oscArg)
|
||||
})
|
||||
typeString += ']'
|
||||
typeString += oscArg.type;
|
||||
flatOSCArgs.push(oscArg);
|
||||
});
|
||||
typeString += ']';
|
||||
} else {
|
||||
typeString += oscArg.type
|
||||
flatOSCArgs.push(oscArg)
|
||||
typeString += oscArg.type;
|
||||
flatOSCArgs.push(oscArg);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const typesBuffer = oscTypeConverterMap.s.toBuffer(typeString);
|
||||
if (typesBuffer === undefined) {
|
||||
@@ -89,7 +89,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
|
||||
|
||||
if (argType === '[') {
|
||||
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 = [];
|
||||
insideArgArray = true;
|
||||
@@ -98,7 +98,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
|
||||
|
||||
if (argType === ']') {
|
||||
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);
|
||||
oscArrayArg = [];
|
||||
@@ -117,7 +117,7 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
|
||||
value: value,
|
||||
};
|
||||
if (insideArgArray) {
|
||||
oscArrayArg.push(arg)
|
||||
oscArrayArg.push(arg);
|
||||
} else {
|
||||
oscArgs.push(arg);
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ const badTests = [
|
||||
name: /^Error$/,
|
||||
message: 'osc message must start with a /',
|
||||
},
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
describe('OSC Message Encoding', () => {
|
||||
|
||||
Reference in New Issue
Block a user