'use strict'

class CommandCallbackMap extends Map {
  act (id, msg) {
    if (!id || typeof id !== 'string') {
      throw new TypeError('id must be a string')
    }

    if (!this.has(id)) {
      throw new TypeError(`missing callback for id ${id}`)
    }

    const cb = this.get(id)

    this.delete(id)

    cb(msg)
  }
}

module.exports = exports = CommandCallbackMap

@@ -7,16 +7,52 @@
 trict'%0A%0A
+const shortid = require('shortid')%0A%0A
 class Co
@@ -119,30 +119,28 @@
  %7C%7C 
-typeof id !== 'string'
+!shortid.isValid(id)
 ) %7B%0A
@@ -171,26 +171,17 @@
 r('i
-d must be a string
+nvalid id
 ')%0A 

Use shortid for validation