views/topics.js
function sanitize (msg) {
  if (typeof msg !== 'object') return null
  if (typeof msg.value !== 'object') return null
  if (typeof msg.value.content !== 'object') return null
  if (typeof msg.value.timestamp !== 'number') return null
  if (typeof msg.value.type !== 'string') return null
  if (typeof msg.value.content.channel !== 'string') return null
  if (typeof msg.value.content.text !== 'string') return null
  return msg
}
function sanitize (msg) {
  if (typeof msg !== 'object') return null
  if (typeof msg.value !== 'object') return null
  if (typeof msg.value.content !== 'object') return null
  if (typeof msg.value.timestamp !== 'number') return null
  if (typeof msg.value.type !== 'string') return null
  if (typeof msg.value.content.channel !== 'string') return null
  if (typeof msg.value.content.text !== 'string') return null
  return msg
}
function sanitize ( msg ) { if ( typeof msg !== 'object' ) return null if ( typeof msg . value !== 'object' ) return null if ( typeof msg . value . content !== 'object' ) return null if ( typeof msg . value . timestamp !== 'number' ) return null if ( typeof msg . value . type !== 'string' ) return null if ( typeof msg . value . content . channel !== 'string' ) return null if ( typeof msg . value . content . text !== 'string' ) return null return msg }
Either returns a well-formed channel message, or null.
Either returns a well - formed channel message or null .