nl_tokens: parse a string in the format topic [ : data ] where data is valid JSON
pl_tokens: function parsePayload ( message ) { const messageParts = message && message . <mask> ( / ^([^:]+)(?::(.*))? / ) if ( ! messageParts ) return { topic : undefined , data : undefined } const topic = messageParts [ 1 ] let data = messageParts [ 2 ] if ( data ) { try { data = JSON . parse ( data ) } catch ( error ) { data = undefined } } return { topic , data } }