/*
 * Adapted from https://github.com/ngerritsen/react-stateless-wrapper (ISC license)
 */
define([
    'react',
    'exports'
], function (
    React,
    exports
) {

    function wrap(statelessComponent) {
        var reactClass = {};

        Object.keys(statelessComponent).forEach(function (key) {
            reactClass[key] = statelessComponent[key];
        });

        reactClass.displayName = statelessComponent.name || statelessComponent.displayName;
        reactClass.render = function() {
            return statelessComponent(this.props, this.context);
        };

        return React.createClass(reactClass);
    }

    exports.wrap = wrap;
});

