Usage
Without button details
const message = `<j 70 "My Loco">` // would come from the Command Station
const rosterItem = rosterItemParser(message)
console.log(rosterItem);
// {
// key: 'j',
// parser: "rosterItemParser",
// params: {
// cabId: 70,
// display: 'My Loco',
// functionButtons: {}
// },
// status: 'success'
// }
With button details
const message = `<j 70 "My Loco" "Flash/Ring/*Blast">` // would come from the Command Station
const rosterItem = rosterItemParser(message)
console.log(rosterItem);
// {
// key: 'j',
// parser: "rosterItemParser",
// params: {
// cabId: 70,
// display: 'My Loco',
// functionButtons: {
// '0': {
// display: 'Flash',
// kind: 'toggle'
// },
// '1': {
// display: 'Ring',
// kind: 'toggle'
// },
// '2': {
// display: 'Blast',
// kind: 'press'
// }
// }
// },
// status: 'success'
// }