mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}if(typeof g.React==="undefined"){throw Error("React module should be required before update")}else if(typeof g.React.addons==="undefined"){g.React.addons={}}g.React.addons.update=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(process){"use strict";var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(format===undefined){error=new Error("Minified exception occurred; use the non-minified dev environment "+"for the full error message and additional helpful warnings.")}else{var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++]}));error.name="Invariant Violation"}error.framesToPop=1;throw error}};var hasOwnProperty={}.hasOwnProperty;function shallowCopy(x){if(Array.isArray(x)){return x.concat()}else if(x&&typeof x==="object"){return Object.assign(new x.constructor,x)}else{return x}}var COMMAND_PUSH="$push";var COMMAND_UNSHIFT="$unshift";var COMMAND_SPLICE="$splice";var COMMAND_SET="$set";var COMMAND_MERGE="$merge";var COMMAND_APPLY="$apply";var ALL_COMMANDS_LIST=[COMMAND_PUSH,COMMAND_UNSHIFT,COMMAND_SPLICE,COMMAND_SET,COMMAND_MERGE,COMMAND_APPLY];var ALL_COMMANDS_SET={};ALL_COMMANDS_LIST.forEach(function(command){ALL_COMMANDS_SET[command]=true});function invariantArrayCase(value,spec,command){invariant(Array.isArray(value),"update(): expected target of %s to be an array; got %s.",command,value);var specValue=spec[command];invariant(Array.isArray(specValue),"update(): expected spec of %s to be an array; got %s. "+"Did you forget to wrap your parameter in an array?",command,specValue)}function update(value,spec){invariant(typeof spec==="object","update(): You provided a key path to update() that did not contain one "+"of %s. Did you forget to include {%s: ...}?",ALL_COMMANDS_LIST.join(", "),COMMAND_SET);if(hasOwnProperty.call(spec,COMMAND_SET)){invariant(Object.keys(spec).length===1,"Cannot have more than one key in an object with %s",COMMAND_SET);return spec[COMMAND_SET]}var nextValue=shallowCopy(value);if(hasOwnProperty.call(spec,COMMAND_MERGE)){var mergeObj=spec[COMMAND_MERGE];invariant(mergeObj&&typeof mergeObj==="object","update(): %s expects a spec of type 'object'; got %s",COMMAND_MERGE,mergeObj);invariant(nextValue&&typeof nextValue==="object","update(): %s expects a target of type 'object'; got %s",COMMAND_MERGE,nextValue);Object.assign(nextValue,spec[COMMAND_MERGE])}if(hasOwnProperty.call(spec,COMMAND_PUSH)){invariantArrayCase(value,spec,COMMAND_PUSH);spec[COMMAND_PUSH].forEach(function(item){nextValue.push(item)})}if(hasOwnProperty.call(spec,COMMAND_UNSHIFT)){invariantArrayCase(value,spec,COMMAND_UNSHIFT);spec[COMMAND_UNSHIFT].forEach(function(item){nextValue.unshift(item)})}if(hasOwnProperty.call(spec,COMMAND_SPLICE)){invariant(Array.isArray(value),"Expected %s target to be an array; got %s",COMMAND_SPLICE,value);invariant(Array.isArray(spec[COMMAND_SPLICE]),"update(): expected spec of %s to be an array of arrays; got %s. "+"Did you forget to wrap your parameters in an array?",COMMAND_SPLICE,spec[COMMAND_SPLICE]);spec[COMMAND_SPLICE].forEach(function(args){invariant(Array.isArray(args),"update(): expected spec of %s to be an array of arrays; got %s. "+"Did you forget to wrap your parameters in an array?",COMMAND_SPLICE,spec[COMMAND_SPLICE]);nextValue.splice.apply(nextValue,args)})}if(hasOwnProperty.call(spec,COMMAND_APPLY)){invariant(typeof spec[COMMAND_APPLY]==="function","update(): expected spec of %s to be a function; got %s.",COMMAND_APPLY,spec[COMMAND_APPLY]);nextValue=spec[COMMAND_APPLY](nextValue)}for(var k in spec){if(!(ALL_COMMANDS_SET.hasOwnProperty(k)&&ALL_COMMANDS_SET[k])){nextValue[k]=update(value[k],spec[k])}}return nextValue}module.exports=update}).call(this,require("_process"))},{_process:2}],2:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}]},{},[1])(1)});
|