mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-20 06:19:00 +00:00
npm run format:write
This commit is contained in:
@@ -7,11 +7,13 @@ export * from './message';
|
||||
export * from './bundle';
|
||||
|
||||
export function fromBuffer(bytes: Uint8Array): [OSCBundle | OSCMessage | undefined, Uint8Array | undefined] {
|
||||
if (bytes[0] === 47) { // starts with '/'
|
||||
return messageFromBuffer(bytes);
|
||||
} else if (bytes[0] === 35) { // starts with '#'
|
||||
return bundleFromBuffer(bytes)
|
||||
} else {
|
||||
throw new Error('bytes do not look like an OSC message or bundle');
|
||||
}
|
||||
}
|
||||
if (bytes[0] === 47) {
|
||||
// starts with '/'
|
||||
return messageFromBuffer(bytes);
|
||||
} else if (bytes[0] === 35) {
|
||||
// starts with '#'
|
||||
return bundleFromBuffer(bytes);
|
||||
} else {
|
||||
throw new Error('bytes do not look like an OSC message or bundle');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user