title: socket io emit generating Right-hand side of 'instanceof' is not an object
body: <p>I am getting the following error </p>
  
  <pre><code>C:\path\app\node_modules\winston\node_modules\cycle\cycle.js:62
                  !(value instanceof String)) {
                          ^
  
  TypeError: Right-hand side of 'instanceof' is not an object
  </code></pre>
  
  <p>on my </p>
  
  <pre><code> return io.to(socket.id).emit('friendsInvited', data);
  </code></pre>
  
  <p>line.
  I have this same code a number of places in but the error only occurs in this block of code....see below:</p>
  
  <pre><code>       socket.on('inviteFriends', function(body) {
                  let inviteesArr = body.split(',');
                  let emailObjArray = validateInvitees(body)
                  console.log("EmailObj Array: " + JSON.stringify(emailObjArray));
  
                  if (emailObjArray.length === 0) {
  
                      data = {
                          code: String = '1',
                          msg: String = 'failmessage...'
                      };
     **&lt;&lt;FAILS HERE&gt;&gt;**   return io.to(socket.id).emit('friendsInvited', data);
                  } else
                  {
                   ...function(a,b,f(c){
                        if (x===0) {} else
                         {
      **&lt;&lt;WORKS HERE&gt;&gt;**   return io.to(socket.id).emit('friendsInvited', data);
                         }
                }}
  .......
  </code></pre>
  
  <p>data is always the same data.code and data.msg. This construct works in many other places except in this code block. I figure I am missing something very basic but cannot see it. I thought I was having a scope issue but I don't thinks so.
  EDIT: here is more stacktrace.....</p>
  
  <pre><code>TypeError: Right-hand side of 'instanceof' is not an object
      at derez (C:\path\app\node_modules\cycle\cycle.js:62:25)
      at Object.decycle (C:\path\app\node_modules\cycle\cycle.js:101:6)
      at Object.exports.clone (C:\path\app\node_modules\winston\lib\winston\common.js:97:22)
      at Object.exports.log (C:\path\app\node_modules\winston\lib\winston\common.js:149:19)
      at exports.Console.Console.log (C:\\path\app\node_modules\winston\lib\winston\transports\console.js:99:19)
      at exports.Console.Transport.logException (C:\path\app\node_modules\winston\lib\winston\transports\transport.js:134:8)
      at logAndWait (C:\path\app\node_modules\winston\lib\winston\logger.js:649:15)
      at C\path\app\\node_modules\winston\node_modules\async\lib\async.js:157:13
      at _each (C:\path\app\node_modules\winston\node_modules\async\lib\async.js:57:9)
      at Object.async.each (C:\path\app\node_modules\winston\node_modules\async\lib\async.js:156:9)
      at exports.Logger.Logger._uncaughtException (C:\path\app\node_modules\winston\lib\winston\logger.js:672:9)
      at emitOne (events.js:116:13)
      at process.emit (events.js:211:7)
      at process._fatalException (bootstrap_node.js:378:26)
  npm ERR! code ELIFECYCLE
  npm ERR! errno 7
  ....
  </code></pre>