mirror of
https://github.com/jwetzell/osc-js.git
synced 2026-08-20 14:29:00 +00:00
allow no type string
This commit is contained in:
@@ -76,6 +76,17 @@ export function messageFromBuffer(bytes: Uint8Array): [OSCMessage | undefined, U
|
|||||||
|
|
||||||
const [address, bytesAfterAddress] = oscTypeConverterMap.s.fromBuffer(bytes);
|
const [address, bytesAfterAddress] = oscTypeConverterMap.s.fromBuffer(bytes);
|
||||||
if (typeof address === 'string') {
|
if (typeof address === 'string') {
|
||||||
|
if(bytesAfterAddress.length === 0){
|
||||||
|
// NOTE(jwetzell): OSC 1.0 spec says that messages without a type string should be allowed
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
address,
|
||||||
|
args: []
|
||||||
|
},
|
||||||
|
bytesAfterAddress
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
let [typeString, bytesAfterType] = oscTypeConverterMap.s.fromBuffer(bytesAfterAddress);
|
let [typeString, bytesAfterType] = oscTypeConverterMap.s.fromBuffer(bytesAfterAddress);
|
||||||
if (typeof typeString === 'string') {
|
if (typeof typeString === 'string') {
|
||||||
if (!typeString.startsWith(',')) {
|
if (!typeString.startsWith(',')) {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ const goodTests = [
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
expected: {
|
||||||
{
|
{
|
||||||
description: 'osc 1.0 spec example 1',
|
description: 'osc 1.0 spec example 1',
|
||||||
bytes: new Uint8Array([
|
bytes: new Uint8Array([
|
||||||
|
|||||||
Reference in New Issue
Block a user