middleware/session/index.js
function extendContext(context, opts) {
  Object.defineProperties(context, {
    [CONTEXT_SESSION]: {
      get() {
        if (this[_CONTEXT_SESSION]) return this[_CONTEXT_SESSION];
        this[_CONTEXT_SESSION] = new ContextSession(this, opts);
        return this[_CONTEXT_SESSION];
      },
      enumerable: true
    },
    session: {
      get() {
        return this[CONTEXT_SESSION].get();
      },
      set(val) {
        this[CONTEXT_SESSION].set(val);
      },
      configurable: true,
      enumerable: true
    },
    sessionOptions: {
      get() {
        return this[CONTEXT_SESSION].opts;
      },
      enumerable: true
    },
  });
}
function extendContext(context, opts) {
  Object.defineProperties(context, {
    [CONTEXT_SESSION]: {
      get() {
        if (this[_CONTEXT_SESSION]) return this[_CONTEXT_SESSION];
        this[_CONTEXT_SESSION] = new ContextSession(this, opts);
        return this[_CONTEXT_SESSION];
      },
      enumerable: true
    },
    session: {
      get() {
        return this[CONTEXT_SESSION].get();
      },
      set(val) {
        this[CONTEXT_SESSION].set(val);
      },
      configurable: true,
      enumerable: true
    },
    sessionOptions: {
      get() {
        return this[CONTEXT_SESSION].opts;
      },
      enumerable: true
    },
  });
}
function extendContext ( context , opts ) { Object . defineProperties ( context , { [ CONTEXT_SESSION ] : { get ( ) { if ( this [ _CONTEXT_SESSION ] ) return this [ _CONTEXT_SESSION ] ; this [ _CONTEXT_SESSION ] = new ContextSession ( this , opts ) ; return this [ _CONTEXT_SESSION ] ; } , enumerable : true } , session : { get ( ) { return this [ CONTEXT_SESSION ] . get ( ) ; } , set ( val ) { this [ CONTEXT_SESSION ] . set ( val ) ; } , configurable : true , enumerable : true } , sessionOptions : { get ( ) { return this [ CONTEXT_SESSION ] . opts ; } , enumerable : true } , } ) ; }
extend context prototype, add session properties

@param  {Object} context koa's context prototype
@param  {Object} opts session options

@api private
extend context prototype add session properties