code: function finish(ch) {
    ch[STATE] = STATES.ENDED
    let waiting = null
    while (
      (waiting = ch.waiting.shift()) // eslint-disable-line no-cond-assign
    ) {
      waiting()
    }
  }
docs: /*
  Marks a channel as ended, and signals any promises
  which are waiting for the end of the channel.