'use strict'; const { h } = require('jsx-node'); module.exports = function (Component, Master) { const locals = Object.assign({ query: this.req.query }, this.app.locals, this.locals); let html; if (typeof Master === 'function') { if (typeof Component === 'function') { return this.send( h(Master, locals, h(Component, locals) ) ); } Component = Master; } if (typeof Component !== 'function') { throw new Error('Not a Component'); } else if (Component.prototype && Component.prototype.render) { const i = new Component(locals); html = i.render(i.props, i.state); } else { html = Component(locals); } this.send(html); };