{"size": 588, "ext": "js", "max_stars_repo_path": "src/react/create-element.js", "max_stars_repo_name": "kjyu/myreact", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/react/create-element.js", "max_issues_repo_name": "kjyu/myreact", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/react/create-element.js", "max_forks_repo_name": "kjyu/myreact", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.6, "max_line_length": 62, "alphanum_fraction": 0.5612244898}
import Component from './component.js'

var MRTagHandlers = {
    tagCount: 1,
    getReactTag: function() {
        this.tagCount++;
        return this.tagCount;
    }
}

function createElement( tag, attrs, ...children ) {

    attrs = attrs || {};
    var child;
    if (children.length === 1 && Array.isArray(children[0])) {
        child = children[0];
    } else {
        child = children;
    }

    return {
        tag,
        attrs,
        children: child,
        key: attrs.key || null,
        _nativeTag: MRTagHandlers.getReactTag()
    }
}

export default createElement;