index.js
function sessionify (fn, session, context) {
  if (!session) {
    throw new Error('sessionify expects a session-cache object as `session`');
  }

  var bind = session.bind;
  if (typeof fn === 'object' && fn.on) {
    bind = session.bindEmitter;
  }

  if (context) {
    bind.call(session, fn, context);
  } else {
    bind.call(session, fn);
  }
  return fn;
}
function sessionify (fn, session, context) {
  if (!session) {
    throw new Error('sessionify expects a session-cache object as `session`');
  }

  var bind = session.bind;
  if (typeof fn === 'object' && fn.on) {
    bind = session.bindEmitter;
  }

  if (context) {
    bind.call(session, fn, context);
  } else {
    bind.call(session, fn);
  }
  return fn;
}
function sessionify ( fn , session , context ) { if ( ! session ) { throw new Error ( 'sessionify expects a session-cache object as `session`' ) ; } var bind = session . bind ; if ( typeof fn === 'object' && fn . on ) { bind = session . bindEmitter ; } if ( context ) { bind . call ( session , fn , context ) ; } else { bind . call ( session , fn ) ; } return fn ; }
Bind a function, EventEmitter, or Stream to the provided session object
with an optional context.

@param  {Function|EventEmitter|Stream} `fn` Object to bind to.
@param  {Object} `session` session-cache object to bind with.
@param  {Object} `context` Optional context to bind to the sesssion.
@return {*} Bound object
@api public
Bind a function EventEmitter or Stream to the provided session object with an optional context .