src/render/context.js
function getContext (componentPrototype, context) {
  if (componentPrototype.contextTypes) {
    const contextTypes = componentPrototype.contextTypes;
    return keys(context).reduce(
      (memo, contextKey) => {
        if (contextKey in contextTypes) {
          memo[contextKey] = context[contextKey];
        }
        return memo;
      },
      Object.create(null)
    );
  }
  return EMPTY_CONTEXT;
}
function getContext (componentPrototype, context) {
  if (componentPrototype.contextTypes) {
    const contextTypes = componentPrototype.contextTypes;
    return keys(context).reduce(
      (memo, contextKey) => {
        if (contextKey in contextTypes) {
          memo[contextKey] = context[contextKey];
        }
        return memo;
      },
      Object.create(null)
    );
  }
  return EMPTY_CONTEXT;
}
function getContext ( componentPrototype , context ) { if ( componentPrototype . contextTypes ) { const contextTypes = componentPrototype . contextTypes ; return keys ( context ) . reduce ( ( memo , contextKey ) => { if ( contextKey in contextTypes ) { memo [ contextKey ] = context [ contextKey ] ; } return memo ; } , Object . create ( null ) ) ; } return EMPTY_CONTEXT ; }
Using a component prototype's `contextTypes`, generate an object that
will be used as React context for a component instance.

@param      {Component}  componentPrototype  The component prototype.
@param      {Object}     context             The master context propagating through
traversal.

@return     {Object}                         The generated context object.
Using a component prototype s contextTypes generate an object that will be used as React context for a component instance .