JSFiddle - React, Tailwind, and code Playground

by kentaromiura

JavaScript

// http://es5.github.com/#x15.2.3.5
var create = Object.create || function create(prototype) {
        var mozLike = ('__proto__' in {});
        var object;

        function Type() {} // An empty constructor.

        if (prototype === null) { // not perfect :(
            object = mozLike ? {
                "__proto__": null
            } : {};
        } else {
            if (typeof prototype !== "object" && typeof prototype !== "function") {
                throw new TypeError("Object prototype may only be an Object or null"); // same msg as Chrome
            }
            Type.prototype = prototype;
            object = new Type();
            if (mozLike) object.__proto__ = prototype;
        }

        return object;
    };