docs: function produce(baseState, producer, patchListener) {
        // prettier-ignore
        if (arguments.length < 1 || arguments.length > 3) throw new Error("produce expects 1 to 3 arguments, got " + arguments.length);
  
        // curried invocation
        if (typeof baseState === "function") {
            // prettier-ignore
            if (typeof producer === "function") throw new Error("if first argument is a function (curried invocation), the second argument to produce cannot be a function");
  
            var initialState = producer;
            var recipe = baseState;
  
            return function () {
                var args = arguments;
  
                var currentState = args[0] === undefined && initialState !== undefined ? initialState : args[0];
  
                return produce(currentState, function (draft) {
                    args[0] = draft; // blegh!
                    return recipe.apply(draft, args);
                });
            };
        }
  
        // prettier-ignore
        {
            if (typeof producer !== "function") throw new Error("if first argument is not a function, the second argument to produce should be a function");
            if (patchListener !== undefined && typeof patchListener !== "function") throw new Error("the third argument of a producer should not be set or a function");
        }
  
        // if state is a primitive, don't bother proxying at all
        if ((typeof baseState === "undefined" ? "undefined" : _typeof(baseState)) !== "object" || baseState === null) {
            var returnValue = producer(baseState);
            return returnValue === undefined ? baseState : returnValue;
        }
  
        if (!isProxyable(baseState)) throw new Error("the first argument to an immer producer should be a primitive, plain object or array, got " + (typeof baseState === "undefined" ? "undefined" : _typeof(baseState)) + ": \"" + baseState + "\"");
        return getUseProxies() ? produceProxy(baseState, producer, patchListener) : produceEs5(baseState, producer, patchListener);
    }