diff options
Diffstat (limited to 'libmproxy/web/static/vendor.js')
-rw-r--r-- | libmproxy/web/static/vendor.js | 6033 |
1 files changed, 3343 insertions, 2690 deletions
diff --git a/libmproxy/web/static/vendor.js b/libmproxy/web/static/vendor.js index 1e83ac50..59d10445 100644 --- a/libmproxy/web/static/vendor.js +++ b/libmproxy/web/static/vendor.js @@ -2,69 +2,74 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ // shim for using process in browser var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canMutationObserver = typeof window !== 'undefined' - && window.MutationObserver; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; } + if (queue.length) { + drainQueue(); + } +} - var queue = []; - - if (canMutationObserver) { - var hiddenDiv = document.createElement("div"); - var observer = new MutationObserver(function () { - var queueList = queue.slice(); - queue.length = 0; - queueList.forEach(function (fn) { - fn(); - }); - }); - - observer.observe(hiddenDiv, { attributes: true }); - - return function nextTick(fn) { - if (!queue.length) { - hiddenDiv.setAttribute('yes', 'no'); - } - queue.push(fn); - }; +function drainQueue() { + if (draining) { + return; } + var timeout = setTimeout(cleanUpNextTick); + draining = true; - if (canPost) { - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; + } + queueIndex = -1; + len = queue.length; } + currentQueue = null; + draining = false; + clearTimeout(timeout); +} - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); +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) { + setTimeout(drainQueue, 0); + } +}; +// v8 likes predictible objects +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 = ''; // empty string to avoid regexp issues +process.versions = {}; function noop() {} @@ -80,15 +85,16 @@ process.binding = function (name) { throw new Error('process.binding is not supported'); }; -// TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; +process.umask = function() { return 0; }; },{}],2:[function(require,module,exports){ -/* - * Copyright (c) 2014, Facebook, Inc. +(function (process){ +/** + * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -96,14 +102,18 @@ process.chdir = function (dir) { * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Dispatcher - * @typechecks + * + * @preventMunge */ -"use strict"; +'use strict'; + +exports.__esModule = true; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } -var invariant = require('./invariant'); +var invariant = require('fbjs/lib/invariant'); -var _lastID = 1; var _prefix = 'ID_'; /** @@ -153,7 +163,7 @@ var _prefix = 'ID_'; * * This payload is digested by both stores: * - * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { + * CountryStore.dispatchToken = flightDispatcher.register(function(payload) { * if (payload.actionType === 'country-update') { * CountryStore.country = payload.selectedCountry; * } @@ -181,15 +191,11 @@ var _prefix = 'ID_'; * flightDispatcher.register(function(payload) { * switch (payload.actionType) { * case 'country-update': + * case 'city-update': * flightDispatcher.waitFor([CityStore.dispatchToken]); * FlightPriceStore.price = * getFlightPriceStore(CountryStore.country, CityStore.city); * break; - * - * case 'city-update': - * FlightPriceStore.price = - * FlightPriceStore(CountryStore.country, CityStore.city); - * break; * } * }); * @@ -198,131 +204,109 @@ var _prefix = 'ID_'; * `FlightPriceStore`. */ +var Dispatcher = (function () { function Dispatcher() { - this.$Dispatcher_callbacks = {}; - this.$Dispatcher_isPending = {}; - this.$Dispatcher_isHandled = {}; - this.$Dispatcher_isDispatching = false; - this.$Dispatcher_pendingPayload = null; + _classCallCheck(this, Dispatcher); + + this._callbacks = {}; + this._isDispatching = false; + this._isHandled = {}; + this._isPending = {}; + this._lastID = 1; } /** * Registers a callback to be invoked with every dispatched payload. Returns * a token that can be used with `waitFor()`. - * - * @param {function} callback - * @return {string} */ - Dispatcher.prototype.register=function(callback) { - var id = _prefix + _lastID++; - this.$Dispatcher_callbacks[id] = callback; + + Dispatcher.prototype.register = function register(callback) { + var id = _prefix + this._lastID++; + this._callbacks[id] = callback; return id; }; /** * Removes a callback based on its token. - * - * @param {string} id */ - Dispatcher.prototype.unregister=function(id) { - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', - id - ); - delete this.$Dispatcher_callbacks[id]; + + Dispatcher.prototype.unregister = function unregister(id) { + !this._callbacks[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', id) : invariant(false) : undefined; + delete this._callbacks[id]; }; /** * Waits for the callbacks specified to be invoked before continuing execution * of the current callback. This method should only be used by a callback in * response to a dispatched payload. - * - * @param {array<string>} ids */ - Dispatcher.prototype.waitFor=function(ids) { - invariant( - this.$Dispatcher_isDispatching, - 'Dispatcher.waitFor(...): Must be invoked while dispatching.' - ); + + Dispatcher.prototype.waitFor = function waitFor(ids) { + !this._isDispatching ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): Must be invoked while dispatching.') : invariant(false) : undefined; for (var ii = 0; ii < ids.length; ii++) { var id = ids[ii]; - if (this.$Dispatcher_isPending[id]) { - invariant( - this.$Dispatcher_isHandled[id], - 'Dispatcher.waitFor(...): Circular dependency detected while ' + - 'waiting for `%s`.', - id - ); + if (this._isPending[id]) { + !this._isHandled[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): Circular dependency detected while ' + 'waiting for `%s`.', id) : invariant(false) : undefined; continue; } - invariant( - this.$Dispatcher_callbacks[id], - 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', - id - ); - this.$Dispatcher_invokeCallback(id); + !this._callbacks[id] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', id) : invariant(false) : undefined; + this._invokeCallback(id); } }; /** * Dispatches a payload to all registered callbacks. - * - * @param {object} payload */ - Dispatcher.prototype.dispatch=function(payload) { - invariant( - !this.$Dispatcher_isDispatching, - 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.' - ); - this.$Dispatcher_startDispatching(payload); + + Dispatcher.prototype.dispatch = function dispatch(payload) { + !!this._isDispatching ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.') : invariant(false) : undefined; + this._startDispatching(payload); try { - for (var id in this.$Dispatcher_callbacks) { - if (this.$Dispatcher_isPending[id]) { + for (var id in this._callbacks) { + if (this._isPending[id]) { continue; } - this.$Dispatcher_invokeCallback(id); + this._invokeCallback(id); } } finally { - this.$Dispatcher_stopDispatching(); + this._stopDispatching(); } }; /** * Is this Dispatcher currently dispatching. - * - * @return {boolean} */ - Dispatcher.prototype.isDispatching=function() { - return this.$Dispatcher_isDispatching; + + Dispatcher.prototype.isDispatching = function isDispatching() { + return this._isDispatching; }; /** * Call the callback stored with the given id. Also do some internal * bookkeeping. * - * @param {string} id * @internal */ - Dispatcher.prototype.$Dispatcher_invokeCallback=function(id) { - this.$Dispatcher_isPending[id] = true; - this.$Dispatcher_callbacks[id](this.$Dispatcher_pendingPayload); - this.$Dispatcher_isHandled[id] = true; + + Dispatcher.prototype._invokeCallback = function _invokeCallback(id) { + this._isPending[id] = true; + this._callbacks[id](this._pendingPayload); + this._isHandled[id] = true; }; /** * Set up bookkeeping needed when dispatching. * - * @param {object} payload * @internal */ - Dispatcher.prototype.$Dispatcher_startDispatching=function(payload) { - for (var id in this.$Dispatcher_callbacks) { - this.$Dispatcher_isPending[id] = false; - this.$Dispatcher_isHandled[id] = false; + + Dispatcher.prototype._startDispatching = function _startDispatching(payload) { + for (var id in this._callbacks) { + this._isPending[id] = false; + this._isHandled[id] = false; } - this.$Dispatcher_pendingPayload = payload; - this.$Dispatcher_isDispatching = true; + this._pendingPayload = payload; + this._isDispatching = true; }; /** @@ -330,17 +314,22 @@ var _prefix = 'ID_'; * * @internal */ - Dispatcher.prototype.$Dispatcher_stopDispatching=function() { - this.$Dispatcher_pendingPayload = null; - this.$Dispatcher_isDispatching = false; + + Dispatcher.prototype._stopDispatching = function _stopDispatching() { + delete this._pendingPayload; + this._isDispatching = false; }; + return Dispatcher; +})(); module.exports = Dispatcher; +}).call(this,require('_process')) -},{"./invariant":3}],3:[function(require,module,exports){ +},{"_process":1,"fbjs/lib/invariant":3}],3:[function(require,module,exports){ +(function (process){ /** - * Copyright (c) 2014, Facebook, Inc. + * Copyright 2013-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -363,8 +352,8 @@ module.exports = Dispatcher; * will remain to ensure logic does not differ in production. */ -var invariant = function(condition, format, a, b, c, d, e, f) { - if (false) { +var invariant = function (condition, format, a, b, c, d, e, f) { + if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } @@ -373,17 +362,13 @@ 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.' - ); + 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( - 'Invariant Violation: ' + - format.replace(/%s/g, function() { return args[argIndex++]; }) - ); + error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + })); } error.framesToPop = 1; // we don't care about invariant's own frame @@ -392,438 +377,23 @@ var invariant = function(condition, format, a, b, c, d, e, f) { }; module.exports = invariant; +}).call(this,require('_process')) -},{}],4:[function(require,module,exports){ -module.exports = require('./lib/'); - -},{"./lib/":5}],5:[function(require,module,exports){ -// Load modules - -var Stringify = require('./stringify'); -var Parse = require('./parse'); - - -// Declare internals - -var internals = {}; - - -module.exports = { - stringify: Stringify, - parse: Parse -}; - -},{"./parse":6,"./stringify":7}],6:[function(require,module,exports){ -// Load modules - -var Utils = require('./utils'); - - -// Declare internals - -var internals = { - delimiter: '&', - depth: 5, - arrayLimit: 20, - parameterLimit: 1000 -}; - - -internals.parseValues = function (str, options) { - - var obj = {}; - var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); - - for (var i = 0, il = parts.length; i < il; ++i) { - var part = parts[i]; - var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; - - if (pos === -1) { - obj[Utils.decode(part)] = ''; - } - else { - var key = Utils.decode(part.slice(0, pos)); - var val = Utils.decode(part.slice(pos + 1)); - - if (Object.prototype.hasOwnProperty(key)) { - continue; - } - - if (!obj.hasOwnProperty(key)) { - obj[key] = val; - } - else { - obj[key] = [].concat(obj[key]).concat(val); - } - } - } - - return obj; -}; - - -internals.parseObject = function (chain, val, options) { - - if (!chain.length) { - return val; - } - - var root = chain.shift(); - - var obj = {}; - if (root === '[]') { - obj = []; - obj = obj.concat(internals.parseObject(chain, val, options)); - } - else { - var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; - var index = parseInt(cleanRoot, 10); - var indexString = '' + index; - if (!isNaN(index) && - root !== cleanRoot && - indexString === cleanRoot && - index >= 0 && - index <= options.arrayLimit) { - - obj = []; - obj[index] = internals.parseObject(chain, val, options); - } - else { - obj[cleanRoot] = internals.parseObject(chain, val, options); - } - } - - return obj; -}; - - -internals.parseKeys = function (key, val, options) { - - if (!key) { - return; - } - - // The regex chunks - - var parent = /^([^\[\]]*)/; - var child = /(\[[^\[\]]*\])/g; - - // Get the parent - - var segment = parent.exec(key); - - // Don't allow them to overwrite object prototype properties - - if (Object.prototype.hasOwnProperty(segment[1])) { - return; - } - - // Stash the parent if it exists - - var keys = []; - if (segment[1]) { - keys.push(segment[1]); - } - - // Loop through children appending to the array until we hit depth - - var i = 0; - while ((segment = child.exec(key)) !== null && i < options.depth) { - - ++i; - if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { - keys.push(segment[1]); - } - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return internals.parseObject(keys, val, options); -}; - - -module.exports = function (str, options) { - - if (str === '' || - str === null || - typeof str === 'undefined') { - - return {}; - } - - options = options || {}; - options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; - - var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; - var obj = {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0, il = keys.length; i < il; ++i) { - var key = keys[i]; - var newObj = internals.parseKeys(key, tempObj[key], options); - obj = Utils.merge(obj, newObj); - } - - return Utils.compact(obj); -}; - -},{"./utils":8}],7:[function(require,module,exports){ -// Load modules - -var Utils = require('./utils'); - - -// Declare internals - -var internals = { - delimiter: '&', - arrayPrefixGenerators: { - brackets: function (prefix, key) { - return prefix + '[]'; - }, - indices: function (prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function (prefix, key) { - return prefix; - } - } -}; - - -internals.stringify = function (obj, prefix, generateArrayPrefix) { - - if (Utils.isBuffer(obj)) { - obj = obj.toString(); - } - else if (obj instanceof Date) { - obj = obj.toISOString(); - } - else if (obj === null) { - obj = ''; - } - - if (typeof obj === 'string' || - typeof obj === 'number' || - typeof obj === 'boolean') { - - return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys = Object.keys(obj); - for (var i = 0, il = objKeys.length; i < il; ++i) { - var key = objKeys[i]; - if (Array.isArray(obj)) { - values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix)); - } - else { - values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix)); - } - } - - return values; -}; - - -module.exports = function (obj, options) { - - options = options || {}; - var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; - - var keys = []; - - if (typeof obj !== 'object' || - obj === null) { - - return ''; - } - - var arrayFormat; - if (options.arrayFormat in internals.arrayPrefixGenerators) { - arrayFormat = options.arrayFormat; - } - else if ('indices' in options) { - arrayFormat = options.indices ? 'indices' : 'repeat'; - } - else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; - - var objKeys = Object.keys(obj); - for (var i = 0, il = objKeys.length; i < il; ++i) { - var key = objKeys[i]; - keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix)); - } - - return keys.join(delimiter); -}; - -},{"./utils":8}],8:[function(require,module,exports){ -// Load modules - - -// Declare internals - -var internals = {}; - - -exports.arrayToObject = function (source) { - - var obj = {}; - for (var i = 0, il = source.length; i < il; ++i) { - if (typeof source[i] !== 'undefined') { - - obj[i] = source[i]; - } - } - - return obj; -}; - - -exports.merge = function (target, source) { - - if (!source) { - return target; - } - - if (typeof source !== 'object') { - if (Array.isArray(target)) { - target.push(source); - } - else { - target[source] = true; - } - - return target; - } - - if (typeof target !== 'object') { - target = [target].concat(source); - return target; - } - - if (Array.isArray(target) && - !Array.isArray(source)) { - - target = exports.arrayToObject(target); - } - - var keys = Object.keys(source); - for (var k = 0, kl = keys.length; k < kl; ++k) { - var key = keys[k]; - var value = source[key]; - - if (!target[key]) { - target[key] = value; - } - else { - target[key] = exports.merge(target[key], value); - } - } - - return target; -}; - - -exports.decode = function (str) { - - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (e) { - return str; - } -}; - - -exports.compact = function (obj, refs) { - - if (typeof obj !== 'object' || - obj === null) { - - return obj; - } - - refs = refs || []; - var lookup = refs.indexOf(obj); - if (lookup !== -1) { - return refs[lookup]; - } - - refs.push(obj); - - if (Array.isArray(obj)) { - var compacted = []; - - for (var i = 0, il = obj.length; i < il; ++i) { - if (typeof obj[i] !== 'undefined') { - compacted.push(obj[i]); - } - } - - return compacted; - } - - var keys = Object.keys(obj); - for (i = 0, il = keys.length; i < il; ++i) { - var key = keys[i]; - obj[key] = exports.compact(obj[key], refs); - } - - return obj; -}; - - -exports.isRegExp = function (obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - - -exports.isBuffer = function (obj) { - - if (obj === null || - typeof obj === 'undefined') { - - return false; - } - - return !!(obj.constructor && - obj.constructor.isBuffer && - obj.constructor.isBuffer(obj)); -}; - -},{}],9:[function(require,module,exports){ -"use strict"; - +},{"_process":1}],4:[function(require,module,exports){ /** * Represents a cancellation caused by navigating away * before the previous transition has fully resolved. */ +"use strict"; + function Cancellation() {} module.exports = Cancellation; -},{}],10:[function(require,module,exports){ -"use strict"; +},{}],5:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; var History = { @@ -838,7 +408,7 @@ var History = { * Sends the browser back one entry in the history. */ back: function back() { - invariant(canUseDOM, "Cannot use History.back without a DOM"); + invariant(canUseDOM, 'Cannot use History.back without a DOM'); // Do this first so that History.length will // be accurate in location change listeners. @@ -850,15 +420,15 @@ var History = { }; module.exports = History; -},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],11:[function(require,module,exports){ -"use strict"; +},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],6:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); /* jshint -W084 */ -var PathUtils = require("./PathUtils"); +var PathUtils = require('./PathUtils'); function deepSearch(route, pathname, query) { // Check the subtree first to find the most deeply-nested match. @@ -903,44 +473,33 @@ var Match = (function () { this.routes = routes; } - _createClass(Match, null, { - findMatch: { + _createClass(Match, null, [{ + key: 'findMatch', - /** - * Attempts to match depth-first a route in the given route's - * subtree against the given path and returns the match if it - * succeeds, null if no match can be made. - */ - - value: function findMatch(routes, path) { - var pathname = PathUtils.withoutQuery(path); - var query = PathUtils.extractQuery(path); - var match = null; + /** + * Attempts to match depth-first a route in the given route's + * subtree against the given path and returns the match if it + * succeeds, null if no match can be made. + */ + value: function findMatch(routes, path) { + var pathname = PathUtils.withoutQuery(path); + var query = PathUtils.extractQuery(path); + var match = null; - for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); + for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query); - return match; - } + return match; } - }); + }]); return Match; })(); module.exports = Match; -},{"./PathUtils":13}],12:[function(require,module,exports){ -"use strict"; - -var warning = require("react/lib/warning"); -var PropTypes = require("./PropTypes"); +},{"./PathUtils":8}],7:[function(require,module,exports){ +'use strict'; -function deprecatedMethod(routerMethodName, fn) { - return function () { - warning(false, "Router.Navigation is deprecated. Please use this.context.router." + routerMethodName + "() instead"); - - return fn.apply(this, arguments); - }; -} +var PropTypes = require('./PropTypes'); /** * A mixin for components that modify the URL. @@ -970,50 +529,50 @@ var Navigation = { * Returns an absolute URL path created from the given route * name, URL parameters, and query values. */ - makePath: deprecatedMethod("makePath", function (to, params, query) { + makePath: function makePath(to, params, query) { return this.context.router.makePath(to, params, query); - }), + }, /** * Returns a string that may safely be used as the href of a * link to the route with the given name. */ - makeHref: deprecatedMethod("makeHref", function (to, params, query) { + makeHref: function makeHref(to, params, query) { return this.context.router.makeHref(to, params, query); - }), + }, /** * Transitions to the URL specified in the arguments by pushing * a new URL onto the history stack. */ - transitionTo: deprecatedMethod("transitionTo", function (to, params, query) { + transitionTo: function transitionTo(to, params, query) { this.context.router.transitionTo(to, params, query); - }), + }, /** * Transitions to the URL specified in the arguments by replacing * the current URL in the history stack. */ - replaceWith: deprecatedMethod("replaceWith", function (to, params, query) { + replaceWith: function replaceWith(to, params, query) { this.context.router.replaceWith(to, params, query); - }), + }, /** * Transitions to the previous URL. */ - goBack: deprecatedMethod("goBack", function () { + goBack: function goBack() { return this.context.router.goBack(); - }) + } }; module.exports = Navigation; -},{"./PropTypes":14,"react/lib/warning":212}],13:[function(require,module,exports){ -"use strict"; +},{"./PropTypes":9}],8:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var objectAssign = require("object-assign"); -var qs = require("qs"); +var invariant = require('react/lib/invariant'); +var assign = require('object-assign'); +var qs = require('qs'); var paramCompileMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\[\]\\+|{}^$]/g; var paramInjectMatcher = /:([a-zA-Z_$][a-zA-Z0-9_$?]*[?]?)|[*]/g; @@ -1028,17 +587,17 @@ function compilePattern(pattern) { var source = pattern.replace(paramCompileMatcher, function (match, paramName) { if (paramName) { paramNames.push(paramName); - return "([^/?#]+)"; - } else if (match === "*") { - paramNames.push("splat"); - return "(.*?)"; + return '([^/?#]+)'; + } else if (match === '*') { + paramNames.push('splat'); + return '(.*?)'; } else { - return "\\" + match; + return '\\' + match; } }); _compiledPatterns[pattern] = { - matcher: new RegExp("^" + source + "$", "i"), + matcher: new RegExp('^' + source + '$', 'i'), paramNames: paramNames }; } @@ -1052,14 +611,14 @@ var PathUtils = { * Returns true if the given path is absolute. */ isAbsolute: function isAbsolute(path) { - return path.charAt(0) === "/"; + return path.charAt(0) === '/'; }, /** * Joins two URL paths together. */ join: function join(a, b) { - return a.replace(/\/*$/, "/") + b; + return a.replace(/\/*$/, '/') + b; }, /** @@ -1103,28 +662,28 @@ var PathUtils = { var splatIndex = 0; return pattern.replace(paramInjectMatcher, function (match, paramName) { - paramName = paramName || "splat"; + paramName = paramName || 'splat'; // If param is optional don't check for existence - if (paramName.slice(-1) === "?") { + if (paramName.slice(-1) === '?') { paramName = paramName.slice(0, -1); - if (params[paramName] == null) return ""; + if (params[paramName] == null) return ''; } else { - invariant(params[paramName] != null, "Missing \"%s\" parameter for path \"%s\"", paramName, pattern); + invariant(params[paramName] != null, 'Missing "%s" parameter for path "%s"', paramName, pattern); } var segment; - if (paramName === "splat" && Array.isArray(params[paramName])) { + if (paramName === 'splat' && Array.isArray(params[paramName])) { segment = params[paramName][splatIndex++]; - invariant(segment != null, "Missing splat # %s for path \"%s\"", splatIndex, pattern); + invariant(segment != null, 'Missing splat # %s for path "%s"', splatIndex, pattern); } else { segment = params[paramName]; } return segment; - }).replace(paramInjectTrailingSlashMatcher, "/"); + }).replace(paramInjectTrailingSlashMatcher, '/'); }, /** @@ -1140,7 +699,7 @@ var PathUtils = { * Returns a version of the given path without the query string. */ withoutQuery: function withoutQuery(path) { - return path.replace(queryMatcher, ""); + return path.replace(queryMatcher, ''); }, /** @@ -1150,24 +709,24 @@ var PathUtils = { withQuery: function withQuery(path, query) { var existingQuery = PathUtils.extractQuery(path); - if (existingQuery) query = query ? objectAssign(existingQuery, query) : existingQuery; + if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery; - var queryString = qs.stringify(query, { arrayFormat: "brackets" }); + var queryString = qs.stringify(query, { arrayFormat: 'brackets' }); if (queryString) { - return PathUtils.withoutQuery(path) + "?" + queryString; + return PathUtils.withoutQuery(path) + '?' + queryString; }return PathUtils.withoutQuery(path); } }; module.exports = PathUtils; -},{"object-assign":41,"qs":4,"react/lib/invariant":191}],14:[function(require,module,exports){ -"use strict"; +},{"object-assign":36,"qs":37,"react/lib/invariant":191}],9:[function(require,module,exports){ +'use strict'; -var assign = require("react/lib/Object.assign"); -var ReactPropTypes = require("react").PropTypes; -var Route = require("./Route"); +var assign = require('react/lib/Object.assign'); +var ReactPropTypes = require('react').PropTypes; +var Route = require('./Route'); var PropTypes = assign({}, ReactPropTypes, { @@ -1176,7 +735,7 @@ var PropTypes = assign({}, ReactPropTypes, { */ falsy: function falsy(props, propName, componentName) { if (props[propName]) { - return new Error("<" + componentName + "> may not have a \"" + propName + "\" prop"); + return new Error('<' + componentName + '> should not have a "' + propName + '" prop'); } }, @@ -1194,12 +753,12 @@ var PropTypes = assign({}, ReactPropTypes, { }); module.exports = PropTypes; -},{"./Route":16,"react":"react","react/lib/Object.assign":69}],15:[function(require,module,exports){ -"use strict"; - +},{"./Route":11,"react":"react","react/lib/Object.assign":69}],10:[function(require,module,exports){ /** * Encapsulates a redirect to the given route. */ +"use strict"; + function Redirect(to, params, query) { this.to = to; this.params = params; @@ -1207,17 +766,17 @@ function Redirect(to, params, query) { } module.exports = Redirect; -},{}],16:[function(require,module,exports){ -"use strict"; +},{}],11:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var assign = require("react/lib/Object.assign"); -var invariant = require("react/lib/invariant"); -var warning = require("react/lib/warning"); -var PathUtils = require("./PathUtils"); +var assign = require('react/lib/Object.assign'); +var invariant = require('react/lib/invariant'); +var warning = require('react/lib/warning'); +var PathUtils = require('./PathUtils'); var _currentRoute; @@ -1236,191 +795,184 @@ var Route = (function () { this.handler = handler; } - _createClass(Route, { - appendChild: { - - /** - * Appends the given route to this route's child routes. - */ - - value: function appendChild(route) { - invariant(route instanceof Route, "route.appendChild must use a valid Route"); + _createClass(Route, [{ + key: 'appendChild', - if (!this.childRoutes) this.childRoutes = []; - - this.childRoutes.push(route); - } - }, - toString: { - value: function toString() { - var string = "<Route"; - - if (this.name) string += " name=\"" + this.name + "\""; + /** + * Appends the given route to this route's child routes. + */ + value: function appendChild(route) { + invariant(route instanceof Route, 'route.appendChild must use a valid Route'); - string += " path=\"" + this.path + "\">"; + if (!this.childRoutes) this.childRoutes = []; - return string; - } + this.childRoutes.push(route); } }, { - createRoute: { - - /** - * Creates and returns a new route. Options may be a URL pathname string - * with placeholders for named params or an object with any of the following - * properties: - * - * - name The name of the route. This is used to lookup a - * route relative to its parent route and should be - * unique among all child routes of the same parent - * - path A URL pathname string with optional placeholders - * that specify the names of params to extract from - * the URL when the path matches. Defaults to `/${name}` - * when there is a name given, or the path of the parent - * route, or / - * - ignoreScrollBehavior True to make this route (and all descendants) ignore - * the scroll behavior of the router - * - isDefault True to make this route the default route among all - * its siblings - * - isNotFound True to make this route the "not found" route among - * all its siblings - * - onEnter A transition hook that will be called when the - * router is going to enter this route - * - onLeave A transition hook that will be called when the - * router is going to leave this route - * - handler A React component that will be rendered when - * this route is active - * - parentRoute The parent route to use for this route. This option - * is automatically supplied when creating routes inside - * the callback to another invocation of createRoute. You - * only ever need to use this when declaring routes - * independently of one another to manually piece together - * the route hierarchy - * - * The callback may be used to structure your route hierarchy. Any call to - * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect - * inside the callback automatically uses this route as its parent. - */ - - value: function createRoute(options, callback) { - options = options || {}; - - if (typeof options === "string") options = { path: options }; - - var parentRoute = _currentRoute; - - if (parentRoute) { - warning(options.parentRoute == null || options.parentRoute === parentRoute, "You should not use parentRoute with createRoute inside another route's child callback; it is ignored"); - } else { - parentRoute = options.parentRoute; - } + key: 'toString', + value: function toString() { + var string = '<Route'; + + if (this.name) string += ' name="' + this.name + '"'; + + string += ' path="' + this.path + '">'; + + return string; + } + }], [{ + key: 'createRoute', + + /** + * Creates and returns a new route. Options may be a URL pathname string + * with placeholders for named params or an object with any of the following + * properties: + * + * - name The name of the route. This is used to lookup a + * route relative to its parent route and should be + * unique among all child routes of the same parent + * - path A URL pathname string with optional placeholders + * that specify the names of params to extract from + * the URL when the path matches. Defaults to `/${name}` + * when there is a name given, or the path of the parent + * route, or / + * - ignoreScrollBehavior True to make this route (and all descendants) ignore + * the scroll behavior of the router + * - isDefault True to make this route the default route among all + * its siblings + * - isNotFound True to make this route the "not found" route among + * all its siblings + * - onEnter A transition hook that will be called when the + * router is going to enter this route + * - onLeave A transition hook that will be called when the + * router is going to leave this route + * - handler A React component that will be rendered when + * this route is active + * - parentRoute The parent route to use for this route. This option + * is automatically supplied when creating routes inside + * the callback to another invocation of createRoute. You + * only ever need to use this when declaring routes + * independently of one another to manually piece together + * the route hierarchy + * + * The callback may be used to structure your route hierarchy. Any call to + * createRoute, createDefaultRoute, createNotFoundRoute, or createRedirect + * inside the callback automatically uses this route as its parent. + */ + value: function createRoute(options, callback) { + options = options || {}; + + if (typeof options === 'string') options = { path: options }; + + var parentRoute = _currentRoute; + + if (parentRoute) { + warning(options.parentRoute == null || options.parentRoute === parentRoute, 'You should not use parentRoute with createRoute inside another route\'s child callback; it is ignored'); + } else { + parentRoute = options.parentRoute; + } - var name = options.name; - var path = options.path || name; + var name = options.name; + var path = options.path || name; - if (path && !(options.isDefault || options.isNotFound)) { - if (PathUtils.isAbsolute(path)) { - if (parentRoute) { - invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, "You cannot nest path \"%s\" inside \"%s\"; the parent requires URL parameters", path, parentRoute.path); - } - } else if (parentRoute) { - // Relative paths extend their parent. - path = PathUtils.join(parentRoute.path, path); - } else { - path = "/" + path; + if (path && !(options.isDefault || options.isNotFound)) { + if (PathUtils.isAbsolute(path)) { + if (parentRoute) { + invariant(path === parentRoute.path || parentRoute.paramNames.length === 0, 'You cannot nest path "%s" inside "%s"; the parent requires URL parameters', path, parentRoute.path); } + } else if (parentRoute) { + // Relative paths extend their parent. + path = PathUtils.join(parentRoute.path, path); } else { - path = parentRoute ? parentRoute.path : "/"; + path = '/' + path; } + } else { + path = parentRoute ? parentRoute.path : '/'; + } - if (options.isNotFound && !/\*$/.test(path)) path += "*"; // Auto-append * to the path of not found routes. - - var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); - - if (parentRoute) { - if (route.isDefault) { - invariant(parentRoute.defaultRoute == null, "%s may not have more than one default route", parentRoute); + if (options.isNotFound && !/\*$/.test(path)) path += '*'; // Auto-append * to the path of not found routes. - parentRoute.defaultRoute = route; - } else if (route.isNotFound) { - invariant(parentRoute.notFoundRoute == null, "%s may not have more than one not found route", parentRoute); + var route = new Route(name, path, options.ignoreScrollBehavior, options.isDefault, options.isNotFound, options.onEnter, options.onLeave, options.handler); - parentRoute.notFoundRoute = route; - } + if (parentRoute) { + if (route.isDefault) { + invariant(parentRoute.defaultRoute == null, '%s may not have more than one default route', parentRoute); - parentRoute.appendChild(route); - } + parentRoute.defaultRoute = route; + } else if (route.isNotFound) { + invariant(parentRoute.notFoundRoute == null, '%s may not have more than one not found route', parentRoute); - // Any routes created in the callback - // use this route as their parent. - if (typeof callback === "function") { - var currentRoute = _currentRoute; - _currentRoute = route; - callback.call(route, route); - _currentRoute = currentRoute; + parentRoute.notFoundRoute = route; } - return route; + parentRoute.appendChild(route); } - }, - createDefaultRoute: { - - /** - * Creates and returns a route that is rendered when its parent matches - * the current URL. - */ - value: function createDefaultRoute(options) { - return Route.createRoute(assign({}, options, { isDefault: true })); + // Any routes created in the callback + // use this route as their parent. + if (typeof callback === 'function') { + var currentRoute = _currentRoute; + _currentRoute = route; + callback.call(route, route); + _currentRoute = currentRoute; } - }, - createNotFoundRoute: { - /** - * Creates and returns a route that is rendered when its parent matches - * the current URL but none of its siblings do. - */ + return route; + } + }, { + key: 'createDefaultRoute', - value: function createNotFoundRoute(options) { - return Route.createRoute(assign({}, options, { isNotFound: true })); - } - }, - createRedirect: { + /** + * Creates and returns a route that is rendered when its parent matches + * the current URL. + */ + value: function createDefaultRoute(options) { + return Route.createRoute(assign({}, options, { isDefault: true })); + } + }, { + key: 'createNotFoundRoute', - /** - * Creates and returns a route that automatically redirects the transition - * to another route. In addition to the normal options to createRoute, this - * function accepts the following options: - * - * - from An alias for the `path` option. Defaults to * - * - to The path/route/route name to redirect to - * - params The params to use in the redirect URL. Defaults - * to using the current params - * - query The query to use in the redirect URL. Defaults - * to using the current query - */ + /** + * Creates and returns a route that is rendered when its parent matches + * the current URL but none of its siblings do. + */ + value: function createNotFoundRoute(options) { + return Route.createRoute(assign({}, options, { isNotFound: true })); + } + }, { + key: 'createRedirect', - value: function createRedirect(options) { - return Route.createRoute(assign({}, options, { - path: options.path || options.from || "*", - onEnter: function onEnter(transition, params, query) { - transition.redirect(options.to, options.params || params, options.query || query); - } - })); - } + /** + * Creates and returns a route that automatically redirects the transition + * to another route. In addition to the normal options to createRoute, this + * function accepts the following options: + * + * - from An alias for the `path` option. Defaults to * + * - to The path/route/route name to redirect to + * - params The params to use in the redirect URL. Defaults + * to using the current params + * - query The query to use in the redirect URL. Defaults + * to using the current query + */ + value: function createRedirect(options) { + return Route.createRoute(assign({}, options, { + path: options.path || options.from || '*', + onEnter: function onEnter(transition, params, query) { + transition.redirect(options.to, options.params || params, options.query || query); + } + })); } - }); + }]); return Route; })(); module.exports = Route; -},{"./PathUtils":13,"react/lib/Object.assign":69,"react/lib/invariant":191,"react/lib/warning":212}],17:[function(require,module,exports){ -"use strict"; +},{"./PathUtils":8,"react/lib/Object.assign":69,"react/lib/invariant":191,"react/lib/warning":212}],12:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; -var getWindowScrollPosition = require("./getWindowScrollPosition"); +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; +var getWindowScrollPosition = require('./getWindowScrollPosition'); function shouldUpdateScroll(state, prevState) { if (!prevState) { @@ -1469,7 +1021,7 @@ var ScrollHistory = { }, componentWillMount: function componentWillMount() { - invariant(this.constructor.getScrollBehavior() == null || canUseDOM, "Cannot use scroll behavior without a DOM"); + invariant(this.constructor.getScrollBehavior() == null || canUseDOM, 'Cannot use scroll behavior without a DOM'); }, componentDidMount: function componentDidMount() { @@ -1491,19 +1043,10 @@ var ScrollHistory = { }; module.exports = ScrollHistory; -},{"./getWindowScrollPosition":32,"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],18:[function(require,module,exports){ -"use strict"; - -var warning = require("react/lib/warning"); -var PropTypes = require("./PropTypes"); - -function deprecatedMethod(routerMethodName, fn) { - return function () { - warning(false, "Router.State is deprecated. Please use this.context.router." + routerMethodName + "() instead"); +},{"./getWindowScrollPosition":27,"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],13:[function(require,module,exports){ +'use strict'; - return fn.apply(this, arguments); - }; -} +var PropTypes = require('./PropTypes'); /** * A mixin for components that need to know the path, routes, URL @@ -1515,10 +1058,10 @@ function deprecatedMethod(routerMethodName, fn) { * mixins: [ Router.State ], * render() { * var className = this.props.className; - * + * * if (this.isActive('about')) * className += ' is-active'; - * + * * return React.DOM.a({ className: className }, this.props.children); * } * }); @@ -1532,56 +1075,56 @@ var State = { /** * Returns the current URL path. */ - getPath: deprecatedMethod("getCurrentPath", function () { + getPath: function getPath() { return this.context.router.getCurrentPath(); - }), + }, /** * Returns the current URL path without the query string. */ - getPathname: deprecatedMethod("getCurrentPathname", function () { + getPathname: function getPathname() { return this.context.router.getCurrentPathname(); - }), + }, /** * Returns an object of the URL params that are currently active. */ - getParams: deprecatedMethod("getCurrentParams", function () { + getParams: function getParams() { return this.context.router.getCurrentParams(); - }), + }, /** * Returns an object of the query params that are currently active. */ - getQuery: deprecatedMethod("getCurrentQuery", function () { + getQuery: function getQuery() { return this.context.router.getCurrentQuery(); - }), + }, /** * Returns an array of the routes that are currently active. */ - getRoutes: deprecatedMethod("getCurrentRoutes", function () { + getRoutes: function getRoutes() { return this.context.router.getCurrentRoutes(); - }), + }, /** * A helper method to determine if a given route, params, and query * are active. */ - isActive: deprecatedMethod("isActive", function (to, params, query) { + isActive: function isActive(to, params, query) { return this.context.router.isActive(to, params, query); - }) + } }; module.exports = State; -},{"./PropTypes":14,"react/lib/warning":212}],19:[function(require,module,exports){ -"use strict"; - +},{"./PropTypes":9}],14:[function(require,module,exports){ /* jshint -W058 */ -var Cancellation = require("./Cancellation"); -var Redirect = require("./Redirect"); +'use strict'; + +var Cancellation = require('./Cancellation'); +var Redirect = require('./Redirect'); /** * Encapsulates a transition to a given path. @@ -1597,7 +1140,7 @@ function Transition(path, retry) { } Transition.prototype.abort = function (reason) { - if (this.abortReason == null) this.abortReason = reason || "ABORT"; + if (this.abortReason == null) this.abortReason = reason || 'ABORT'; }; Transition.prototype.redirect = function (to, params, query) { @@ -1651,36 +1194,36 @@ Transition.to = function (transition, routes, params, query, callback) { }; module.exports = Transition; -},{"./Cancellation":9,"./Redirect":15}],20:[function(require,module,exports){ -"use strict"; - +},{"./Cancellation":4,"./Redirect":10}],15:[function(require,module,exports){ /** * Actions that modify the URL. */ +'use strict'; + var LocationActions = { /** * Indicates a new location is being pushed to the history stack. */ - PUSH: "push", + PUSH: 'push', /** * Indicates the current location should be replaced. */ - REPLACE: "replace", + REPLACE: 'replace', /** * Indicates the most recent entry should be removed from the history stack. */ - POP: "pop" + POP: 'pop' }; module.exports = LocationActions; -},{}],21:[function(require,module,exports){ -"use strict"; +},{}],16:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); +var LocationActions = require('../actions/LocationActions'); /** * A scroll behavior that attempts to imitate the default behavior @@ -1707,13 +1250,13 @@ var ImitateBrowserBehavior = { }; module.exports = ImitateBrowserBehavior; -},{"../actions/LocationActions":20}],22:[function(require,module,exports){ -"use strict"; - +},{"../actions/LocationActions":15}],17:[function(require,module,exports){ /** * A scroll behavior that always scrolls to the top of the page * after a transition. */ +"use strict"; + var ScrollToTopBehavior = { updateScrollPosition: function updateScrollPosition() { @@ -1723,14 +1266,14 @@ var ScrollToTopBehavior = { }; module.exports = ScrollToTopBehavior; -},{}],23:[function(require,module,exports){ -"use strict"; +},{}],18:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; /** * This component is necessary to get around a context warning @@ -1738,7 +1281,7 @@ var _classCallCheck = function (instance, Constructor) { if (!(instance instance * between the "owner" and "parent" contexts. */ -var React = require("react"); +var React = require('react'); var ContextWrapper = (function (_React$Component) { function ContextWrapper() { @@ -1751,28 +1294,27 @@ var ContextWrapper = (function (_React$Component) { _inherits(ContextWrapper, _React$Component); - _createClass(ContextWrapper, { - render: { - value: function render() { - return this.props.children; - } + _createClass(ContextWrapper, [{ + key: 'render', + value: function render() { + return this.props.children; } - }); + }]); return ContextWrapper; })(React.Component); module.exports = ContextWrapper; -},{"react":"react"}],24:[function(require,module,exports){ -"use strict"; +},{"react":"react"}],19:[function(require,module,exports){ +'use strict'; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); +var Route = require('./Route'); /** * A <DefaultRoute> component is a special kind of <Route> that @@ -1811,18 +1353,18 @@ DefaultRoute.defaultProps = { }; module.exports = DefaultRoute; -},{"../PropTypes":14,"./Route":28,"./RouteHandler":29}],25:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],20:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var React = require("react"); -var assign = require("react/lib/Object.assign"); -var PropTypes = require("../PropTypes"); +var React = require('react'); +var assign = require('react/lib/Object.assign'); +var PropTypes = require('../PropTypes'); function isLeftClickEvent(event) { return event.button === 0; @@ -1862,67 +1404,64 @@ var Link = (function (_React$Component) { _inherits(Link, _React$Component); - _createClass(Link, { - handleClick: { - value: function handleClick(event) { - var allowTransition = true; - var clickResult; - - if (this.props.onClick) clickResult = this.props.onClick(event); + _createClass(Link, [{ + key: 'handleClick', + value: function handleClick(event) { + var allowTransition = true; + var clickResult; - if (isModifiedEvent(event) || !isLeftClickEvent(event)) { - return; - }if (clickResult === false || event.defaultPrevented === true) allowTransition = false; - - event.preventDefault(); + if (this.props.onClick) clickResult = this.props.onClick(event); - if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); - } - }, - getHref: { + if (isModifiedEvent(event) || !isLeftClickEvent(event)) { + return; + }if (clickResult === false || event.defaultPrevented === true) allowTransition = false; - /** - * Returns the value of the "href" attribute to use on the DOM element. - */ + event.preventDefault(); - value: function getHref() { - return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); - } - }, - getClassName: { + if (allowTransition) this.context.router.transitionTo(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'getHref', - /** - * Returns the value of the "class" attribute to use on the DOM element, which contains - * the value of the activeClassName property when this <Link> is active. - */ + /** + * Returns the value of the "href" attribute to use on the DOM element. + */ + value: function getHref() { + return this.context.router.makeHref(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'getClassName', - value: function getClassName() { - var className = this.props.className; + /** + * Returns the value of the "class" attribute to use on the DOM element, which contains + * the value of the activeClassName property when this <Link> is active. + */ + value: function getClassName() { + var className = this.props.className; - if (this.getActiveState()) className += " " + this.props.activeClassName; + if (this.getActiveState()) className += ' ' + this.props.activeClassName; - return className; - } - }, - getActiveState: { - value: function getActiveState() { - return this.context.router.isActive(this.props.to, this.props.params, this.props.query); - } - }, - render: { - value: function render() { - var props = assign({}, this.props, { - href: this.getHref(), - className: this.getClassName(), - onClick: this.handleClick.bind(this) - }); + return className; + } + }, { + key: 'getActiveState', + value: function getActiveState() { + return this.context.router.isActive(this.props.to, this.props.params, this.props.query); + } + }, { + key: 'render', + value: function render() { + var props = assign({}, this.props, { + href: this.getHref(), + className: this.getClassName(), + onClick: this.handleClick.bind(this) + }); - if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle; + if (props.activeStyle && this.getActiveState()) props.style = props.activeStyle; - return React.DOM.a(props, this.props.children); - } + return React.DOM.a(props, this.props.children); } - }); + }]); return Link; })(React.Component); @@ -1945,21 +1484,21 @@ Link.propTypes = { }; Link.defaultProps = { - activeClassName: "active", - className: "" + activeClassName: 'active', + className: '' }; module.exports = Link; -},{"../PropTypes":14,"react":"react","react/lib/Object.assign":69}],26:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"react":"react","react/lib/Object.assign":69}],21:[function(require,module,exports){ +'use strict'; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); +var Route = require('./Route'); /** * A <NotFoundRoute> is a special kind of <Route> that @@ -1999,15 +1538,15 @@ NotFoundRoute.defaultProps = { }; module.exports = NotFoundRoute; -},{"../PropTypes":14,"./Route":28,"./RouteHandler":29}],27:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23,"./RouteHandler":24}],22:[function(require,module,exports){ +'use strict'; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var PropTypes = require("../PropTypes"); -var Route = require("./Route"); +var PropTypes = require('../PropTypes'); +var Route = require('./Route'); /** * A <Redirect> component is a special kind of <Route> that always @@ -2043,19 +1582,19 @@ Redirect.propTypes = { Redirect.defaultProps = {}; module.exports = Redirect; -},{"../PropTypes":14,"./Route":28}],28:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./Route":23}],23:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var React = require("react"); -var invariant = require("react/lib/invariant"); -var PropTypes = require("../PropTypes"); -var RouteHandler = require("./RouteHandler"); +var React = require('react'); +var invariant = require('react/lib/invariant'); +var PropTypes = require('../PropTypes'); +var RouteHandler = require('./RouteHandler'); /** * <Route> components specify components that are rendered to the page when the @@ -2109,13 +1648,12 @@ var Route = (function (_React$Component) { _inherits(Route, _React$Component); - _createClass(Route, { - render: { - value: function render() { - invariant(false, "%s elements are for router configuration only and should not be rendered", this.constructor.name); - } + _createClass(Route, [{ + key: 'render', + value: function render() { + invariant(false, '%s elements are for router configuration only and should not be rendered', this.constructor.name); } - }); + }]); return Route; })(React.Component); @@ -2136,21 +1674,21 @@ Route.defaultProps = { }; module.exports = Route; -},{"../PropTypes":14,"./RouteHandler":29,"react":"react","react/lib/invariant":191}],29:[function(require,module,exports){ -"use strict"; +},{"../PropTypes":9,"./RouteHandler":24,"react":"react","react/lib/invariant":191}],24:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _inherits = function (subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }; -var React = require("react"); -var ContextWrapper = require("./ContextWrapper"); -var assign = require("react/lib/Object.assign"); -var PropTypes = require("../PropTypes"); +var React = require('react'); +var ContextWrapper = require('./ContextWrapper'); +var assign = require('react/lib/Object.assign'); +var PropTypes = require('../PropTypes'); -var REF_NAME = "__routeHandler__"; +var REF_NAME = '__routeHandler__'; /** * A <RouteHandler> component renders the active child route handler @@ -2168,57 +1706,65 @@ var RouteHandler = (function (_React$Component) { _inherits(RouteHandler, _React$Component); - _createClass(RouteHandler, { - getChildContext: { - value: function getChildContext() { - return { - routeDepth: this.context.routeDepth + 1 - }; - } - }, - componentDidMount: { - value: function componentDidMount() { - this._updateRouteComponent(this.refs[REF_NAME]); - } - }, - componentDidUpdate: { - value: function componentDidUpdate() { - this._updateRouteComponent(this.refs[REF_NAME]); - } - }, - componentWillUnmount: { - value: function componentWillUnmount() { - this._updateRouteComponent(null); - } - }, - _updateRouteComponent: { - value: function _updateRouteComponent(component) { - this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component); - } - }, - getRouteDepth: { - value: function getRouteDepth() { - return this.context.routeDepth; - } - }, - createChildRouteHandler: { - value: function createChildRouteHandler(props) { - var route = this.context.router.getRouteAtDepth(this.getRouteDepth()); - return route ? React.createElement(route.handler, assign({}, props || this.props, { ref: REF_NAME })) : null; - } - }, - render: { - value: function render() { - var handler = this.createChildRouteHandler(); - // <script/> for things like <CSSTransitionGroup/> that don't like null - return handler ? React.createElement( - ContextWrapper, - null, - handler - ) : React.createElement("script", null); - } + _createClass(RouteHandler, [{ + key: 'getChildContext', + value: function getChildContext() { + return { + routeDepth: this.context.routeDepth + 1 + }; } - }); + }, { + key: 'componentDidMount', + value: function componentDidMount() { + this._updateRouteComponent(this.refs[REF_NAME]); + } + }, { + key: 'componentDidUpdate', + value: function componentDidUpdate() { + this._updateRouteComponent(this.refs[REF_NAME]); + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + this._updateRouteComponent(null); + } + }, { + key: '_updateRouteComponent', + value: function _updateRouteComponent(component) { + this.context.router.setRouteComponentAtDepth(this.getRouteDepth(), component); + } + }, { + key: 'getRouteDepth', + value: function getRouteDepth() { + return this.context.routeDepth; + } + }, { + key: 'createChildRouteHandler', + value: function createChildRouteHandler(props) { + var route = this.context.router.getRouteAtDepth(this.getRouteDepth()); + + if (route == null) { + return null; + }var childProps = assign({}, props || this.props, { + ref: REF_NAME, + params: this.context.router.getCurrentParams(), + query: this.context.router.getCurrentQuery() + }); + + return React.createElement(route.handler, childProps); + } + }, { + key: 'render', + value: function render() { + var handler = this.createChildRouteHandler(); + // <script/> for things like <CSSTransitionGroup/> that don't like null + return handler ? React.createElement( + ContextWrapper, + null, + handler + ) : React.createElement('script', null); + } + }]); return RouteHandler; })(React.Component); @@ -2237,38 +1783,38 @@ RouteHandler.childContextTypes = { }; module.exports = RouteHandler; -},{"../PropTypes":14,"./ContextWrapper":23,"react":"react","react/lib/Object.assign":69}],30:[function(require,module,exports){ +},{"../PropTypes":9,"./ContextWrapper":18,"react":"react","react/lib/Object.assign":69}],25:[function(require,module,exports){ (function (process){ -"use strict"; - /* jshint -W058 */ -var React = require("react"); -var warning = require("react/lib/warning"); -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; -var LocationActions = require("./actions/LocationActions"); -var ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior"); -var HashLocation = require("./locations/HashLocation"); -var HistoryLocation = require("./locations/HistoryLocation"); -var RefreshLocation = require("./locations/RefreshLocation"); -var StaticLocation = require("./locations/StaticLocation"); -var ScrollHistory = require("./ScrollHistory"); -var createRoutesFromReactChildren = require("./createRoutesFromReactChildren"); -var isReactChildren = require("./isReactChildren"); -var Transition = require("./Transition"); -var PropTypes = require("./PropTypes"); -var Redirect = require("./Redirect"); -var History = require("./History"); -var Cancellation = require("./Cancellation"); -var Match = require("./Match"); -var Route = require("./Route"); -var supportsHistory = require("./supportsHistory"); -var PathUtils = require("./PathUtils"); +'use strict'; + +var React = require('react'); +var warning = require('react/lib/warning'); +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; +var LocationActions = require('./actions/LocationActions'); +var ImitateBrowserBehavior = require('./behaviors/ImitateBrowserBehavior'); +var HashLocation = require('./locations/HashLocation'); +var HistoryLocation = require('./locations/HistoryLocation'); +var RefreshLocation = require('./locations/RefreshLocation'); +var StaticLocation = require('./locations/StaticLocation'); +var ScrollHistory = require('./ScrollHistory'); +var createRoutesFromReactChildren = require('./createRoutesFromReactChildren'); +var isReactChildren = require('./isReactChildren'); +var Transition = require('./Transition'); +var PropTypes = require('./PropTypes'); +var Redirect = require('./Redirect'); +var History = require('./History'); +var Cancellation = require('./Cancellation'); +var Match = require('./Match'); +var Route = require('./Route'); +var supportsHistory = require('./supportsHistory'); +var PathUtils = require('./PathUtils'); /** * The default location for new routers. */ -var DEFAULT_LOCATION = canUseDOM ? HashLocation : "/"; +var DEFAULT_LOCATION = canUseDOM ? HashLocation : '/'; /** * The default scroll behavior for new routers. @@ -2306,7 +1852,7 @@ function addRoutesToNamedRoutes(routes, namedRoutes) { route = routes[i]; if (route.name) { - invariant(namedRoutes[route.name] == null, "You may not have more than one route named \"%s\"", route.name); + invariant(namedRoutes[route.name] == null, 'You may not have more than one route named "%s"', route.name); namedRoutes[route.name] = route; } @@ -2364,12 +1910,12 @@ function createRouter(options) { var pendingTransition = null; var dispatchHandler = null; - if (typeof location === "string") location = new StaticLocation(location); + if (typeof location === 'string') location = new StaticLocation(location); if (location instanceof StaticLocation) { - warning(!canUseDOM || process.env.NODE_ENV === "test", "You should not use a static location in a DOM environment because " + "the router will not be kept in sync with the current URL"); + warning(!canUseDOM || process.env.NODE_ENV === 'test', 'You should not use a static location in a DOM environment because ' + 'the router will not be kept in sync with the current URL'); } else { - invariant(canUseDOM || location.needsDOM === false, "You cannot use %s without a DOM", location); + invariant(canUseDOM || location.needsDOM === false, 'You cannot use %s without a DOM', location); } // Automatically fall back to full page refreshes in @@ -2378,7 +1924,7 @@ function createRouter(options) { var Router = React.createClass({ - displayName: "Router", + displayName: 'Router', statics: { @@ -2437,7 +1983,7 @@ function createRouter(options) { } else { var route = to instanceof Route ? to : Router.namedRoutes[to]; - invariant(route instanceof Route, "Cannot find a route named \"%s\"", to); + invariant(route instanceof Route, 'Cannot find a route named "%s"', to); path = route.path; } @@ -2451,7 +1997,7 @@ function createRouter(options) { */ makeHref: function makeHref(to, params, query) { var path = Router.makePath(to, params, query); - return location === HashLocation ? "#" + path : path; + return location === HashLocation ? '#' + path : path; }, /** @@ -2494,13 +2040,13 @@ function createRouter(options) { return true; } - warning(false, "goBack() was ignored because there is no router history"); + warning(false, 'goBack() was ignored because there is no router history'); return false; }, handleAbort: options.onAbort || function (abortReason) { - if (location instanceof StaticLocation) throw new Error("Unhandled aborted transition! Reason: " + abortReason); + if (location instanceof StaticLocation) throw new Error('Unhandled aborted transition! Reason: ' + abortReason); if (abortReason instanceof Cancellation) { return; @@ -2552,7 +2098,7 @@ function createRouter(options) { var match = Router.match(path); - warning(match != null, "No route matches path \"%s\". Make sure you have <Route path=\"%s\"> somewhere in your routes", path, path); + warning(match != null, 'No route matches path "%s". Make sure you have <Route path="%s"> somewhere in your routes', path, path); if (match == null) match = {}; @@ -2607,7 +2153,7 @@ function createRouter(options) { * Router.*Location objects (e.g. Router.HashLocation or Router.HistoryLocation). */ run: function run(callback) { - invariant(!Router.isRunning, "Router is already running"); + invariant(!Router.isRunning, 'Router is already running'); dispatchHandler = function (error, transition, newState) { if (error) Router.handleError(error); @@ -2754,20 +2300,21 @@ function createRouter(options) { module.exports = createRouter; }).call(this,require('_process')) -},{"./Cancellation":9,"./History":10,"./Match":11,"./PathUtils":13,"./PropTypes":14,"./Redirect":15,"./Route":16,"./ScrollHistory":17,"./Transition":19,"./actions/LocationActions":20,"./behaviors/ImitateBrowserBehavior":21,"./createRoutesFromReactChildren":31,"./isReactChildren":33,"./locations/HashLocation":34,"./locations/HistoryLocation":35,"./locations/RefreshLocation":36,"./locations/StaticLocation":37,"./supportsHistory":40,"_process":1,"react":"react","react/lib/ExecutionEnvironment":62,"react/lib/invariant":191,"react/lib/warning":212}],31:[function(require,module,exports){ -"use strict"; +},{"./Cancellation":4,"./History":5,"./Match":6,"./PathUtils":8,"./PropTypes":9,"./Redirect":10,"./Route":11,"./ScrollHistory":12,"./Transition":14,"./actions/LocationActions":15,"./behaviors/ImitateBrowserBehavior":16,"./createRoutesFromReactChildren":26,"./isReactChildren":28,"./locations/HashLocation":29,"./locations/HistoryLocation":30,"./locations/RefreshLocation":31,"./locations/StaticLocation":32,"./supportsHistory":35,"_process":1,"react":"react","react/lib/ExecutionEnvironment":62,"react/lib/invariant":191,"react/lib/warning":212}],26:[function(require,module,exports){ /* jshint -W084 */ -var React = require("react"); -var assign = require("react/lib/Object.assign"); -var warning = require("react/lib/warning"); -var DefaultRoute = require("./components/DefaultRoute"); -var NotFoundRoute = require("./components/NotFoundRoute"); -var Redirect = require("./components/Redirect"); -var Route = require("./Route"); +'use strict'; + +var React = require('react'); +var assign = require('react/lib/Object.assign'); +var warning = require('react/lib/warning'); +var DefaultRoute = require('./components/DefaultRoute'); +var NotFoundRoute = require('./components/NotFoundRoute'); +var Redirect = require('./components/Redirect'); +var Route = require('./Route'); function checkPropTypes(componentName, propTypes, props) { - componentName = componentName || "UnknownComponent"; + componentName = componentName || 'UnknownComponent'; for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { @@ -2836,17 +2383,17 @@ function createRoutesFromReactChildren(children) { } module.exports = createRoutesFromReactChildren; -},{"./Route":16,"./components/DefaultRoute":24,"./components/NotFoundRoute":26,"./components/Redirect":27,"react":"react","react/lib/Object.assign":69,"react/lib/warning":212}],32:[function(require,module,exports){ -"use strict"; +},{"./Route":11,"./components/DefaultRoute":19,"./components/NotFoundRoute":21,"./components/Redirect":22,"react":"react","react/lib/Object.assign":69,"react/lib/warning":212}],27:[function(require,module,exports){ +'use strict'; -var invariant = require("react/lib/invariant"); -var canUseDOM = require("react/lib/ExecutionEnvironment").canUseDOM; +var invariant = require('react/lib/invariant'); +var canUseDOM = require('react/lib/ExecutionEnvironment').canUseDOM; /** * Returns the current scroll position of the window as { x, y }. */ function getWindowScrollPosition() { - invariant(canUseDOM, "Cannot get current scroll position without a DOM"); + invariant(canUseDOM, 'Cannot get current scroll position without a DOM'); return { x: window.pageXOffset || document.documentElement.scrollLeft, @@ -2855,10 +2402,10 @@ function getWindowScrollPosition() { } module.exports = getWindowScrollPosition; -},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],33:[function(require,module,exports){ -"use strict"; +},{"react/lib/ExecutionEnvironment":62,"react/lib/invariant":191}],28:[function(require,module,exports){ +'use strict'; -var React = require("react"); +var React = require('react'); function isValidChild(object) { return object == null || React.isValidElement(object); @@ -2869,11 +2416,11 @@ function isReactChildren(object) { } module.exports = isReactChildren; -},{"react":"react"}],34:[function(require,module,exports){ -"use strict"; +},{"react":"react"}],29:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); var _listeners = []; var _isListening = false; @@ -2895,9 +2442,9 @@ function notifyChange(type) { function ensureSlash() { var path = HashLocation.getCurrentPath(); - if (path.charAt(0) === "/") { + if (path.charAt(0) === '/') { return true; - }HashLocation.replace("/" + path); + }HashLocation.replace('/' + path); return false; } @@ -2927,9 +2474,9 @@ var HashLocation = { if (!_isListening) { if (window.addEventListener) { - window.addEventListener("hashchange", onHashChange, false); + window.addEventListener('hashchange', onHashChange, false); } else { - window.attachEvent("onhashchange", onHashChange); + window.attachEvent('onhashchange', onHashChange); } _isListening = true; @@ -2943,9 +2490,9 @@ var HashLocation = { if (_listeners.length === 0) { if (window.removeEventListener) { - window.removeEventListener("hashchange", onHashChange, false); + window.removeEventListener('hashchange', onHashChange, false); } else { - window.removeEvent("onhashchange", onHashChange); + window.removeEvent('onhashchange', onHashChange); } _isListening = false; @@ -2959,7 +2506,7 @@ var HashLocation = { replace: function replace(path) { _actionType = LocationActions.REPLACE; - window.location.replace(window.location.pathname + window.location.search + "#" + path); + window.location.replace(window.location.pathname + window.location.search + '#' + path); }, pop: function pop() { @@ -2971,21 +2518,21 @@ var HashLocation = { return decodeURI( // We can't use window.location.hash here because it's not // consistent across browsers - Firefox will pre-decode it! - window.location.href.split("#")[1] || ""); + window.location.href.split('#')[1] || ''); }, toString: function toString() { - return "<HashLocation>"; + return '<HashLocation>'; } }; module.exports = HashLocation; -},{"../History":10,"../actions/LocationActions":20}],35:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15}],30:[function(require,module,exports){ +'use strict'; -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); var _listeners = []; var _isListening = false; @@ -3019,9 +2566,9 @@ var HistoryLocation = { if (!_isListening) { if (window.addEventListener) { - window.addEventListener("popstate", onPopState, false); + window.addEventListener('popstate', onPopState, false); } else { - window.attachEvent("onpopstate", onPopState); + window.attachEvent('onpopstate', onPopState); } _isListening = true; @@ -3035,9 +2582,9 @@ var HistoryLocation = { if (_listeners.length === 0) { if (window.addEventListener) { - window.removeEventListener("popstate", onPopState, false); + window.removeEventListener('popstate', onPopState, false); } else { - window.removeEvent("onpopstate", onPopState); + window.removeEvent('onpopstate', onPopState); } _isListening = false; @@ -3045,13 +2592,13 @@ var HistoryLocation = { }, push: function push(path) { - window.history.pushState({ path: path }, "", path); + window.history.pushState({ path: path }, '', path); History.length += 1; notifyChange(LocationActions.PUSH); }, replace: function replace(path) { - window.history.replaceState({ path: path }, "", path); + window.history.replaceState({ path: path }, '', path); notifyChange(LocationActions.REPLACE); }, @@ -3062,17 +2609,17 @@ var HistoryLocation = { }, toString: function toString() { - return "<HistoryLocation>"; + return '<HistoryLocation>'; } }; module.exports = HistoryLocation; -},{"../History":10,"../actions/LocationActions":20}],36:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15}],31:[function(require,module,exports){ +'use strict'; -var HistoryLocation = require("./HistoryLocation"); -var History = require("../History"); +var HistoryLocation = require('./HistoryLocation'); +var History = require('../History'); /** * A Location that uses full page refreshes. This is used as @@ -3094,23 +2641,23 @@ var RefreshLocation = { getCurrentPath: HistoryLocation.getCurrentPath, toString: function toString() { - return "<RefreshLocation>"; + return '<RefreshLocation>'; } }; module.exports = RefreshLocation; -},{"../History":10,"./HistoryLocation":35}],37:[function(require,module,exports){ -"use strict"; +},{"../History":5,"./HistoryLocation":30}],32:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var invariant = require("react/lib/invariant"); +var invariant = require('react/lib/invariant'); function throwCannotModify() { - invariant(false, "You cannot modify a static location"); + invariant(false, 'You cannot modify a static location'); } /** @@ -3126,18 +2673,17 @@ var StaticLocation = (function () { this.path = path; } - _createClass(StaticLocation, { - getCurrentPath: { - value: function getCurrentPath() { - return this.path; - } - }, - toString: { - value: function toString() { - return "<StaticLocation path=\"" + this.path + "\">"; - } + _createClass(StaticLocation, [{ + key: 'getCurrentPath', + value: function getCurrentPath() { + return this.path; } - }); + }, { + key: 'toString', + value: function toString() { + return '<StaticLocation path="' + this.path + '">'; + } + }]); return StaticLocation; })(); @@ -3151,16 +2697,16 @@ StaticLocation.prototype.replace = throwCannotModify; StaticLocation.prototype.pop = throwCannotModify; module.exports = StaticLocation; -},{"react/lib/invariant":191}],38:[function(require,module,exports){ -"use strict"; +},{"react/lib/invariant":191}],33:[function(require,module,exports){ +'use strict'; -var _createClass = (function () { function defineProperties(target, props) { for (var key in props) { var prop = props[key]; prop.configurable = true; if (prop.value) prop.writable = true; } Object.defineProperties(target, props); } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); +var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }; -var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); -var invariant = require("react/lib/invariant"); -var LocationActions = require("../actions/LocationActions"); -var History = require("../History"); +var invariant = require('react/lib/invariant'); +var LocationActions = require('../actions/LocationActions'); +var History = require('../History'); /** * A location that is convenient for testing and does not require a DOM. @@ -3175,82 +2721,81 @@ var TestLocation = (function () { this._updateHistoryLength(); } - _createClass(TestLocation, { - needsDOM: { - get: function () { - return false; - } - }, - _updateHistoryLength: { - value: function _updateHistoryLength() { - History.length = this.history.length; - } - }, - _notifyChange: { - value: function _notifyChange(type) { - var change = { - path: this.getCurrentPath(), - type: type - }; + _createClass(TestLocation, [{ + key: 'needsDOM', + get: function () { + return false; + } + }, { + key: '_updateHistoryLength', + value: function _updateHistoryLength() { + History.length = this.history.length; + } + }, { + key: '_notifyChange', + value: function _notifyChange(type) { + var change = { + path: this.getCurrentPath(), + type: type + }; - for (var i = 0, len = this.listeners.length; i < len; ++i) this.listeners[i].call(this, change); - } - }, - addChangeListener: { - value: function addChangeListener(listener) { - this.listeners.push(listener); - } - }, - removeChangeListener: { - value: function removeChangeListener(listener) { - this.listeners = this.listeners.filter(function (l) { - return l !== listener; - }); - } - }, - push: { - value: function push(path) { - this.history.push(path); - this._updateHistoryLength(); - this._notifyChange(LocationActions.PUSH); - } - }, - replace: { - value: function replace(path) { - invariant(this.history.length, "You cannot replace the current path with no history"); + for (var i = 0, len = this.listeners.length; i < len; ++i) this.listeners[i].call(this, change); + } + }, { + key: 'addChangeListener', + value: function addChangeListener(listener) { + this.listeners.push(listener); + } + }, { + key: 'removeChangeListener', + value: function removeChangeListener(listener) { + this.listeners = this.listeners.filter(function (l) { + return l !== listener; + }); + } + }, { + key: 'push', + value: function push(path) { + this.history.push(path); + this._updateHistoryLength(); + this._notifyChange(LocationActions.PUSH); + } + }, { + key: 'replace', + value: function replace(path) { + invariant(this.history.length, 'You cannot replace the current path with no history'); - this.history[this.history.length - 1] = path; + this.history[this.history.length - 1] = path; - this._notifyChange(LocationActions.REPLACE); - } - }, - pop: { - value: function pop() { - this.history.pop(); - this._updateHistoryLength(); - this._notifyChange(LocationActions.POP); - } - }, - getCurrentPath: { - value: function getCurrentPath() { - return this.history[this.history.length - 1]; - } - }, - toString: { - value: function toString() { - return "<TestLocation>"; - } + this._notifyChange(LocationActions.REPLACE); } - }); + }, { + key: 'pop', + value: function pop() { + this.history.pop(); + this._updateHistoryLength(); + this._notifyChange(LocationActions.POP); + } + }, { + key: 'getCurrentPath', + value: function getCurrentPath() { + return this.history[this.history.length - 1]; + } + }, { + key: 'toString', + value: function toString() { + return '<TestLocation>'; + } + }]); return TestLocation; })(); module.exports = TestLocation; -},{"../History":10,"../actions/LocationActions":20,"react/lib/invariant":191}],39:[function(require,module,exports){ -"use strict"; +},{"../History":5,"../actions/LocationActions":15,"react/lib/invariant":191}],34:[function(require,module,exports){ +'use strict'; -var createRouter = require("./createRouter"); +var createRouter = require('./createRouter'); /** * A high-level convenience method that creates, configures, and @@ -3282,7 +2827,7 @@ var createRouter = require("./createRouter"); * }); */ function runRouter(routes, location, callback) { - if (typeof location === "function") { + if (typeof location === 'function') { callback = location; location = null; } @@ -3298,8 +2843,8 @@ function runRouter(routes, location, callback) { } module.exports = runRouter; -},{"./createRouter":30}],40:[function(require,module,exports){ -"use strict"; +},{"./createRouter":25}],35:[function(require,module,exports){ +'use strict'; function supportsHistory() { /*! taken from modernizr @@ -3308,14 +2853,14 @@ function supportsHistory() { * changed to avoid false negatives for Windows Phones: https://github.com/rackt/react-router/issues/586 */ var ua = navigator.userAgent; - if ((ua.indexOf("Android 2.") !== -1 || ua.indexOf("Android 4.0") !== -1) && ua.indexOf("Mobile Safari") !== -1 && ua.indexOf("Chrome") === -1 && ua.indexOf("Windows Phone") === -1) { + if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) { return false; } - return window.history && "pushState" in window.history; + return window.history && 'pushState' in window.history; } module.exports = supportsHistory; -},{}],41:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ 'use strict'; function ToObject(val) { @@ -3343,6 +2888,422 @@ module.exports = Object.assign || function (target, source) { return to; }; +},{}],37:[function(require,module,exports){ +module.exports = require('./lib/'); + +},{"./lib/":38}],38:[function(require,module,exports){ +// Load modules + +var Stringify = require('./stringify'); +var Parse = require('./parse'); + + +// Declare internals + +var internals = {}; + + +module.exports = { + stringify: Stringify, + parse: Parse +}; + +},{"./parse":39,"./stringify":40}],39:[function(require,module,exports){ +// Load modules + +var Utils = require('./utils'); + + +// Declare internals + +var internals = { + delimiter: '&', + depth: 5, + arrayLimit: 20, + parameterLimit: 1000 +}; + + +internals.parseValues = function (str, options) { + + var obj = {}; + var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); + + for (var i = 0, il = parts.length; i < il; ++i) { + var part = parts[i]; + var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; + + if (pos === -1) { + obj[Utils.decode(part)] = ''; + } + else { + var key = Utils.decode(part.slice(0, pos)); + var val = Utils.decode(part.slice(pos + 1)); + + if (Object.prototype.hasOwnProperty(key)) { + continue; + } + + if (!obj.hasOwnProperty(key)) { + obj[key] = val; + } + else { + obj[key] = [].concat(obj[key]).concat(val); + } + } + } + + return obj; +}; + + +internals.parseObject = function (chain, val, options) { + + if (!chain.length) { + return val; + } + + var root = chain.shift(); + + var obj = {}; + if (root === '[]') { + obj = []; + obj = obj.concat(internals.parseObject(chain, val, options)); + } + else { + var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; + var index = parseInt(cleanRoot, 10); + var indexString = '' + index; + if (!isNaN(index) && + root !== cleanRoot && + indexString === cleanRoot && + index >= 0 && + index <= options.arrayLimit) { + + obj = []; + obj[index] = internals.parseObject(chain, val, options); + } + else { + obj[cleanRoot] = internals.parseObject(chain, val, options); + } + } + + return obj; +}; + + +internals.parseKeys = function (key, val, options) { + + if (!key) { + return; + } + + // The regex chunks + + var parent = /^([^\[\]]*)/; + var child = /(\[[^\[\]]*\])/g; + + // Get the parent + + var segment = parent.exec(key); + + // Don't allow them to overwrite object prototype properties + + if (Object.prototype.hasOwnProperty(segment[1])) { + return; + } + + // Stash the parent if it exists + + var keys = []; + if (segment[1]) { + keys.push(segment[1]); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while ((segment = child.exec(key)) !== null && i < options.depth) { + + ++i; + if (!Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { + keys.push(segment[1]); + } + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return internals.parseObject(keys, val, options); +}; + + +module.exports = function (str, options) { + + if (str === '' || + str === null || + typeof str === 'undefined') { + + return {}; + } + + options = options || {}; + options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; + options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; + options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; + options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; + + var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; + var obj = {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0, il = keys.length; i < il; ++i) { + var key = keys[i]; + var newObj = internals.parseKeys(key, tempObj[key], options); + obj = Utils.merge(obj, newObj); + } + + return Utils.compact(obj); +}; + +},{"./utils":41}],40:[function(require,module,exports){ +// Load modules + +var Utils = require('./utils'); + + +// Declare internals + +var internals = { + delimiter: '&', + arrayPrefixGenerators: { + brackets: function (prefix, key) { + return prefix + '[]'; + }, + indices: function (prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function (prefix, key) { + return prefix; + } + } +}; + + +internals.stringify = function (obj, prefix, generateArrayPrefix) { + + if (Utils.isBuffer(obj)) { + obj = obj.toString(); + } + else if (obj instanceof Date) { + obj = obj.toISOString(); + } + else if (obj === null) { + obj = ''; + } + + if (typeof obj === 'string' || + typeof obj === 'number' || + typeof obj === 'boolean') { + + return [encodeURIComponent(prefix) + '=' + encodeURIComponent(obj)]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys = Object.keys(obj); + for (var i = 0, il = objKeys.length; i < il; ++i) { + var key = objKeys[i]; + if (Array.isArray(obj)) { + values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix)); + } + else { + values = values.concat(internals.stringify(obj[key], prefix + '[' + key + ']', generateArrayPrefix)); + } + } + + return values; +}; + + +module.exports = function (obj, options) { + + options = options || {}; + var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; + + var keys = []; + + if (typeof obj !== 'object' || + obj === null) { + + return ''; + } + + var arrayFormat; + if (options.arrayFormat in internals.arrayPrefixGenerators) { + arrayFormat = options.arrayFormat; + } + else if ('indices' in options) { + arrayFormat = options.indices ? 'indices' : 'repeat'; + } + else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; + + var objKeys = Object.keys(obj); + for (var i = 0, il = objKeys.length; i < il; ++i) { + var key = objKeys[i]; + keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix)); + } + + return keys.join(delimiter); +}; + +},{"./utils":41}],41:[function(require,module,exports){ +// Load modules + + +// Declare internals + +var internals = {}; + + +exports.arrayToObject = function (source) { + + var obj = {}; + for (var i = 0, il = source.length; i < il; ++i) { + if (typeof source[i] !== 'undefined') { + + obj[i] = source[i]; + } + } + + return obj; +}; + + +exports.merge = function (target, source) { + + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (Array.isArray(target)) { + target.push(source); + } + else { + target[source] = true; + } + + return target; + } + + if (typeof target !== 'object') { + target = [target].concat(source); + return target; + } + + if (Array.isArray(target) && + !Array.isArray(source)) { + + target = exports.arrayToObject(target); + } + + var keys = Object.keys(source); + for (var k = 0, kl = keys.length; k < kl; ++k) { + var key = keys[k]; + var value = source[key]; + + if (!target[key]) { + target[key] = value; + } + else { + target[key] = exports.merge(target[key], value); + } + } + + return target; +}; + + +exports.decode = function (str) { + + try { + return decodeURIComponent(str.replace(/\+/g, ' ')); + } catch (e) { + return str; + } +}; + + +exports.compact = function (obj, refs) { + + if (typeof obj !== 'object' || + obj === null) { + + return obj; + } + + refs = refs || []; + var lookup = refs.indexOf(obj); + if (lookup !== -1) { + return refs[lookup]; + } + + refs.push(obj); + + if (Array.isArray(obj)) { + var compacted = []; + + for (var i = 0, il = obj.length; i < il; ++i) { + if (typeof obj[i] !== 'undefined') { + compacted.push(obj[i]); + } + } + + return compacted; + } + + var keys = Object.keys(obj); + for (i = 0, il = keys.length; i < il; ++i) { + var key = keys[i]; + obj[key] = exports.compact(obj[key], refs); + } + + return obj; +}; + + +exports.isRegExp = function (obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + + +exports.isBuffer = function (obj) { + + if (obj === null || + typeof obj === 'undefined') { + + return false; + } + + return !!(obj.constructor && + obj.constructor.isBuffer && + obj.constructor.isBuffer(obj)); +}; + },{}],42:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -3977,6 +3938,7 @@ var CSSCore = { module.exports = CSSCore; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],45:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -4000,7 +3962,9 @@ var isUnitlessNumber = { columnCount: true, flex: true, flexGrow: true, + flexPositive: true, flexShrink: true, + flexNegative: true, fontWeight: true, lineClamp: true, lineHeight: true, @@ -4013,7 +3977,9 @@ var isUnitlessNumber = { // SVG-related properties fillOpacity: true, - strokeOpacity: true + strokeDashoffset: true, + strokeOpacity: true, + strokeWidth: true }; /** @@ -4280,6 +4246,7 @@ var CSSPropertyOperations = { module.exports = CSSPropertyOperations; }).call(this,require('_process')) + },{"./CSSProperty":45,"./ExecutionEnvironment":62,"./camelizeStyleName":162,"./dangerousStyleValue":169,"./hyphenateStyleName":189,"./memoizeStringOnly":200,"./warning":212,"_process":1}],47:[function(require,module,exports){ (function (process){ /** @@ -4380,6 +4347,7 @@ PooledClass.addPoolingTo(CallbackQueue); module.exports = CallbackQueue; }).call(this,require('_process')) + },{"./Object.assign":69,"./PooledClass":70,"./invariant":191,"_process":1}],48:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -4925,6 +4893,7 @@ var DOMChildrenOperations = { module.exports = DOMChildrenOperations; }).call(this,require('_process')) + },{"./Danger":53,"./ReactMultiChildUpdateTypes":119,"./invariant":191,"./setTextContent":206,"_process":1}],51:[function(require,module,exports){ (function (process){ /** @@ -5224,6 +5193,7 @@ var DOMProperty = { module.exports = DOMProperty; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],52:[function(require,module,exports){ (function (process){ /** @@ -5416,6 +5386,7 @@ var DOMPropertyOperations = { module.exports = DOMPropertyOperations; }).call(this,require('_process')) + },{"./DOMProperty":51,"./quoteAttributeValueForBrowser":204,"./warning":212,"_process":1}],53:[function(require,module,exports){ (function (process){ /** @@ -5603,6 +5574,7 @@ var Danger = { module.exports = Danger; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./createNodesFromMarkup":167,"./emptyFunction":170,"./getMarkupWrap":183,"./invariant":191,"_process":1}],54:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -5944,6 +5916,7 @@ var EventListener = { module.exports = EventListener; }).call(this,require('_process')) + },{"./emptyFunction":170,"_process":1}],58:[function(require,module,exports){ (function (process){ /** @@ -6222,6 +6195,7 @@ var EventPluginHub = { module.exports = EventPluginHub; }).call(this,require('_process')) + },{"./EventPluginRegistry":59,"./EventPluginUtils":60,"./accumulateInto":159,"./forEachAccumulated":176,"./invariant":191,"_process":1}],59:[function(require,module,exports){ (function (process){ /** @@ -6502,6 +6476,7 @@ var EventPluginRegistry = { module.exports = EventPluginRegistry; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],60:[function(require,module,exports){ (function (process){ /** @@ -6723,6 +6698,7 @@ var EventPluginUtils = { module.exports = EventPluginUtils; }).call(this,require('_process')) + },{"./EventConstants":56,"./invariant":191,"_process":1}],61:[function(require,module,exports){ (function (process){ /** @@ -6865,6 +6841,7 @@ var EventPropagators = { module.exports = EventPropagators; }).call(this,require('_process')) + },{"./EventConstants":56,"./EventPluginHub":58,"./accumulateInto":159,"./forEachAccumulated":176,"_process":1}],62:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -7100,6 +7077,7 @@ var HTMLDOMPropertyConfig = { headers: null, height: MUST_USE_ATTRIBUTE, hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, + high: null, href: null, hrefLang: null, htmlFor: null, @@ -7110,6 +7088,7 @@ var HTMLDOMPropertyConfig = { lang: null, list: MUST_USE_ATTRIBUTE, loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, + low: null, manifest: MUST_USE_ATTRIBUTE, marginHeight: null, marginWidth: null, @@ -7124,6 +7103,7 @@ var HTMLDOMPropertyConfig = { name: null, noValidate: HAS_BOOLEAN_VALUE, open: HAS_BOOLEAN_VALUE, + optimum: null, pattern: null, placeholder: null, poster: null, @@ -7137,6 +7117,7 @@ var HTMLDOMPropertyConfig = { rowSpan: null, sandbox: null, scope: null, + scoped: HAS_BOOLEAN_VALUE, scrolling: null, seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, @@ -7178,7 +7159,9 @@ var HTMLDOMPropertyConfig = { itemID: MUST_USE_ATTRIBUTE, itemRef: MUST_USE_ATTRIBUTE, // property is supported for OpenGraph in meta tags. - property: null + property: null, + // IE-only attribute that controls focus behavior + unselectable: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { acceptCharset: 'accept-charset', @@ -7402,6 +7385,7 @@ var LinkedValueUtils = { module.exports = LinkedValueUtils; }).call(this,require('_process')) + },{"./ReactPropTypes":126,"./invariant":191,"_process":1}],67:[function(require,module,exports){ (function (process){ /** @@ -7459,6 +7443,7 @@ var LocalEventTrapMixin = { module.exports = LocalEventTrapMixin; }).call(this,require('_process')) + },{"./ReactBrowserEventEmitter":73,"./accumulateInto":159,"./forEachAccumulated":176,"./invariant":191,"_process":1}],68:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -7682,6 +7667,7 @@ var PooledClass = { module.exports = PooledClass; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],71:[function(require,module,exports){ (function (process){ /** @@ -7794,7 +7780,7 @@ if ("production" !== process.env.NODE_ENV) { if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { console.debug( 'Download the React DevTools for a better development experience: ' + - 'http://fb.me/react-devtools' + 'https://fb.me/react-devtools' ); } } @@ -7821,7 +7807,7 @@ if ("production" !== process.env.NODE_ENV) { if (!expectedFeatures[i]) { console.error( 'One or more ES5 shim/shams expected by React are not available: ' + - 'http://fb.me/react-warning-polyfills' + 'https://fb.me/react-warning-polyfills' ); break; } @@ -7829,11 +7815,12 @@ if ("production" !== process.env.NODE_ENV) { } } -React.version = '0.13.1'; +React.version = '0.13.3'; module.exports = React; }).call(this,require('_process')) + },{"./EventPluginUtils":60,"./ExecutionEnvironment":62,"./Object.assign":69,"./ReactChildren":77,"./ReactClass":78,"./ReactComponent":79,"./ReactContext":84,"./ReactCurrentOwner":85,"./ReactDOM":86,"./ReactDOMTextComponent":97,"./ReactDefaultInjection":100,"./ReactElement":103,"./ReactElementValidator":104,"./ReactInstanceHandles":112,"./ReactMount":117,"./ReactPerf":122,"./ReactPropTypes":126,"./ReactReconciler":129,"./ReactServerRendering":132,"./findDOMNode":173,"./onlyChild":201,"_process":1}],72:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -8436,6 +8423,7 @@ var ReactCSSTransitionGroupChild = React.createClass({ module.exports = ReactCSSTransitionGroupChild; }).call(this,require('_process')) + },{"./CSSCore":44,"./React":71,"./ReactTransitionEvents":137,"./onlyChild":201,"./warning":212,"_process":1}],76:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -8716,6 +8704,7 @@ var ReactChildren = { module.exports = ReactChildren; }).call(this,require('_process')) + },{"./PooledClass":70,"./ReactFragment":109,"./traverseAllChildren":210,"./warning":212,"_process":1}],78:[function(require,module,exports){ (function (process){ /** @@ -9554,7 +9543,7 @@ var ReactClass = { ("production" !== process.env.NODE_ENV ? warning( this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + - 'JSX instead. See: http://fb.me/react-legacyfactory' + 'JSX instead. See: https://fb.me/react-legacyfactory' ) : null); } @@ -9662,6 +9651,7 @@ var ReactClass = { module.exports = ReactClass; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactComponent":79,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactErrorUtils":106,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./ReactUpdateQueue":139,"./invariant":191,"./keyMirror":197,"./keyOf":198,"./warning":212,"_process":1}],79:[function(require,module,exports){ (function (process){ /** @@ -9766,20 +9756,38 @@ ReactComponent.prototype.forceUpdate = function(callback) { */ if ("production" !== process.env.NODE_ENV) { var deprecatedAPIs = { - getDOMNode: 'getDOMNode', - isMounted: 'isMounted', - replaceProps: 'replaceProps', - replaceState: 'replaceState', - setProps: 'setProps' + getDOMNode: [ + 'getDOMNode', + 'Use React.findDOMNode(component) instead.' + ], + isMounted: [ + 'isMounted', + 'Instead, make sure to clean up subscriptions and pending requests in ' + + 'componentWillUnmount to prevent memory leaks.' + ], + replaceProps: [ + 'replaceProps', + 'Instead, call React.render again at the top level.' + ], + replaceState: [ + 'replaceState', + 'Refactor your code to use setState instead (see ' + + 'https://github.com/facebook/react/issues/3236).' + ], + setProps: [ + 'setProps', + 'Instead, call React.render again at the top level.' + ] }; - var defineDeprecationWarning = function(methodName, displayName) { + var defineDeprecationWarning = function(methodName, info) { try { Object.defineProperty(ReactComponent.prototype, methodName, { get: function() { ("production" !== process.env.NODE_ENV ? warning( false, - '%s(...) is deprecated in plain JavaScript React classes.', - displayName + '%s(...) is deprecated in plain JavaScript React classes. %s', + info[0], + info[1] ) : null); return undefined; } @@ -9798,6 +9806,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = ReactComponent; }).call(this,require('_process')) + },{"./ReactUpdateQueue":139,"./invariant":191,"./warning":212,"_process":1}],80:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -9906,6 +9915,7 @@ var ReactComponentEnvironment = { module.exports = ReactComponentEnvironment; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],82:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -10134,6 +10144,14 @@ var ReactCompositeComponentMixin = { this.getName() || 'a component' ) : null); ("production" !== process.env.NODE_ENV ? warning( + !inst.getDefaultProps || + inst.getDefaultProps.isReactClassApproved, + 'getDefaultProps was defined on %s, a plain JavaScript class. ' + + 'This is only supported for classes created using React.createClass. ' + + 'Use a static property to define defaultProps instead.', + this.getName() || 'a component' + ) : null); + ("production" !== process.env.NODE_ENV ? warning( !inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', @@ -10169,6 +10187,7 @@ var ReactCompositeComponentMixin = { this._pendingReplaceState = false; this._pendingForceUpdate = false; + var childContext; var renderedElement; var previouslyMounting = ReactLifeCycle.currentlyMountingInstance; @@ -10183,7 +10202,8 @@ var ReactCompositeComponentMixin = { } } - renderedElement = this._renderValidatedComponent(); + childContext = this._getValidatedChildContext(context); + renderedElement = this._renderValidatedComponent(childContext); } finally { ReactLifeCycle.currentlyMountingInstance = previouslyMounting; } @@ -10197,7 +10217,7 @@ var ReactCompositeComponentMixin = { this._renderedComponent, rootID, transaction, - this._processChildContext(context) + this._mergeChildContext(context, childContext) ); if (inst.componentDidMount) { transaction.getReactMountReady().enqueue(inst.componentDidMount, inst); @@ -10327,7 +10347,7 @@ var ReactCompositeComponentMixin = { * @return {object} * @private */ - _processChildContext: function(currentContext) { + _getValidatedChildContext: function(currentContext) { var inst = this._instance; var childContext = inst.getChildContext && inst.getChildContext(); if (childContext) { @@ -10352,6 +10372,13 @@ var ReactCompositeComponentMixin = { name ) : invariant(name in inst.constructor.childContextTypes)); } + return childContext; + } + return null; + }, + + _mergeChildContext: function(currentContext, childContext) { + if (childContext) { return assign({}, currentContext, childContext); } return currentContext; @@ -10611,6 +10638,10 @@ var ReactCompositeComponentMixin = { return inst.state; } + if (replace && queue.length === 1) { + return queue[0]; + } + var nextState = assign({}, replace ? queue[0] : inst.state); for (var i = replace ? 1 : 0; i < queue.length; i++) { var partial = queue[i]; @@ -10680,13 +10711,14 @@ var ReactCompositeComponentMixin = { _updateRenderedComponent: function(transaction, context) { var prevComponentInstance = this._renderedComponent; var prevRenderedElement = prevComponentInstance._currentElement; - var nextRenderedElement = this._renderValidatedComponent(); + var childContext = this._getValidatedChildContext(); + var nextRenderedElement = this._renderValidatedComponent(childContext); if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) { ReactReconciler.receiveComponent( prevComponentInstance, nextRenderedElement, transaction, - this._processChildContext(context) + this._mergeChildContext(context, childContext) ); } else { // These two IDs are actually the same! But nothing should rely on that. @@ -10702,7 +10734,7 @@ var ReactCompositeComponentMixin = { this._renderedComponent, thisID, transaction, - context + this._mergeChildContext(context, childContext) ); this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup); } @@ -10740,11 +10772,12 @@ var ReactCompositeComponentMixin = { /** * @private */ - _renderValidatedComponent: function() { + _renderValidatedComponent: function(childContext) { var renderedComponent; var previousContext = ReactContext.current; - ReactContext.current = this._processChildContext( - this._currentElement._context + ReactContext.current = this._mergeChildContext( + this._currentElement._context, + childContext ); ReactCurrentOwner.current = this; try { @@ -10845,6 +10878,7 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactComponentEnvironment":81,"./ReactContext":84,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactElementValidator":104,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactNativeComponent":120,"./ReactPerf":122,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./ReactReconciler":129,"./ReactUpdates":140,"./emptyObject":171,"./invariant":191,"./shouldUpdateReactComponent":208,"./warning":212,"_process":1}],84:[function(require,module,exports){ (function (process){ /** @@ -10923,6 +10957,7 @@ var ReactContext = { module.exports = ReactContext; }).call(this,require('_process')) + },{"./Object.assign":69,"./emptyObject":171,"./warning":212,"_process":1}],85:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11113,6 +11148,7 @@ var ReactDOM = mapObject({ // SVG circle: 'circle', + clipPath: 'clipPath', defs: 'defs', ellipse: 'ellipse', g: 'g', @@ -11135,6 +11171,7 @@ var ReactDOM = mapObject({ module.exports = ReactDOM; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactElementValidator":104,"./mapObject":199,"_process":1}],87:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11264,11 +11301,13 @@ function assertValidProps(props) { 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' ) : invariant(props.children == null)); ("production" !== process.env.NODE_ENV ? invariant( - props.dangerouslySetInnerHTML.__html != null, + typeof props.dangerouslySetInnerHTML === 'object' && + '__html' in props.dangerouslySetInnerHTML, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + - 'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' + + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.' - ) : invariant(props.dangerouslySetInnerHTML.__html != null)); + ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' && + '__html' in props.dangerouslySetInnerHTML)); } if ("production" !== process.env.NODE_ENV) { ("production" !== process.env.NODE_ENV ? warning( @@ -11576,6 +11615,8 @@ ReactDOMComponent.Mixin = { if (propKey === STYLE) { if (nextProp) { nextProp = this._previousStyleCopy = assign({}, nextProp); + } else { + this._previousStyleCopy = null; } if (lastProp) { // Unset styles on `lastProp` but not on `nextProp`. @@ -11705,6 +11746,7 @@ ReactDOMComponent.injection = { module.exports = ReactDOMComponent; }).call(this,require('_process')) + },{"./CSSPropertyOperations":46,"./DOMProperty":51,"./DOMPropertyOperations":52,"./Object.assign":69,"./ReactBrowserEventEmitter":73,"./ReactComponentBrowserEnvironment":80,"./ReactMount":117,"./ReactMultiChild":118,"./ReactPerf":122,"./escapeTextContentForBrowser":172,"./invariant":191,"./isEventSupported":192,"./keyOf":198,"./warning":212,"_process":1}],89:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -11922,6 +11964,7 @@ ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', { module.exports = ReactDOMIDOperations; }).call(this,require('_process')) + },{"./CSSPropertyOperations":46,"./DOMChildrenOperations":50,"./DOMPropertyOperations":52,"./ReactMount":117,"./ReactPerf":122,"./invariant":191,"./setInnerHTML":205,"_process":1}],91:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -12190,6 +12233,7 @@ var ReactDOMInput = ReactClass.createClass({ module.exports = ReactDOMInput; }).call(this,require('_process')) + },{"./AutoFocusMixin":42,"./DOMPropertyOperations":52,"./LinkedValueUtils":66,"./Object.assign":69,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./ReactMount":117,"./ReactUpdates":140,"./invariant":191,"_process":1}],94:[function(require,module,exports){ (function (process){ /** @@ -12242,6 +12286,7 @@ var ReactDOMOption = ReactClass.createClass({ module.exports = ReactDOMOption; }).call(this,require('_process')) + },{"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./warning":212,"_process":1}],95:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -12890,6 +12935,7 @@ var ReactDOMTextarea = ReactClass.createClass({ module.exports = ReactDOMTextarea; }).call(this,require('_process')) + },{"./AutoFocusMixin":42,"./DOMPropertyOperations":52,"./LinkedValueUtils":66,"./Object.assign":69,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactElement":103,"./ReactUpdates":140,"./invariant":191,"./warning":212,"_process":1}],99:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -13122,6 +13168,7 @@ module.exports = { }; }).call(this,require('_process')) + },{"./BeforeInputEventPlugin":43,"./ChangeEventPlugin":48,"./ClientReactRootIndex":49,"./DefaultEventPluginOrder":54,"./EnterLeaveEventPlugin":55,"./ExecutionEnvironment":62,"./HTMLDOMPropertyConfig":64,"./MobileSafariClickEventPlugin":68,"./ReactBrowserComponentMixin":72,"./ReactClass":78,"./ReactComponentBrowserEnvironment":80,"./ReactDOMButton":87,"./ReactDOMComponent":88,"./ReactDOMForm":89,"./ReactDOMIDOperations":90,"./ReactDOMIframe":91,"./ReactDOMImg":92,"./ReactDOMInput":93,"./ReactDOMOption":94,"./ReactDOMSelect":95,"./ReactDOMTextComponent":97,"./ReactDOMTextarea":98,"./ReactDefaultBatchingStrategy":99,"./ReactDefaultPerf":101,"./ReactElement":103,"./ReactEventListener":108,"./ReactInjection":110,"./ReactInstanceHandles":112,"./ReactMount":117,"./ReactReconcileTransaction":128,"./SVGDOMPropertyConfig":142,"./SelectEventPlugin":143,"./ServerReactRootIndex":144,"./SimpleEventPlugin":145,"./createFullPageComponent":166,"_process":1}],101:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -13902,6 +13949,7 @@ ReactElement.isValidElement = function(object) { module.exports = ReactElement; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactContext":84,"./ReactCurrentOwner":85,"./warning":212,"_process":1}],104:[function(require,module,exports){ (function (process){ /** @@ -14072,7 +14120,7 @@ function warnAndMonitorForKeyUse(message, element, parentType) { ("production" !== process.env.NODE_ENV ? warning( false, - message + '%s%s See http://fb.me/react-warning-keys for more information.', + message + '%s%s See https://fb.me/react-warning-keys for more information.', parentOrOwnerAddendum, childOwnerAddendum ) : null); @@ -14196,9 +14244,9 @@ function warnForPropsMutation(propName, element) { ("production" !== process.env.NODE_ENV ? warning( false, - 'Don\'t set .props.%s of the React component%s. ' + - 'Instead, specify the correct value when ' + - 'initially creating the element.%s', + 'Don\'t set .props.%s of the React component%s. Instead, specify the ' + + 'correct value when initially creating the element or use ' + + 'React.cloneElement to make a new element with updated props.%s', propName, elementInfo, ownerInfo @@ -14367,6 +14415,7 @@ var ReactElementValidator = { module.exports = ReactElementValidator; }).call(this,require('_process')) + },{"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactFragment":109,"./ReactNativeComponent":120,"./ReactPropTypeLocationNames":124,"./ReactPropTypeLocations":125,"./getIteratorFn":182,"./invariant":191,"./warning":212,"_process":1}],105:[function(require,module,exports){ (function (process){ /** @@ -14462,6 +14511,7 @@ var ReactEmptyComponent = { module.exports = ReactEmptyComponent; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactInstanceMap":113,"./invariant":191,"_process":1}],106:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -14912,6 +14962,7 @@ var ReactFragment = { module.exports = ReactFragment; }).call(this,require('_process')) + },{"./ReactElement":103,"./warning":212,"_process":1}],110:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -15425,6 +15476,7 @@ var ReactInstanceHandles = { module.exports = ReactInstanceHandles; }).call(this,require('_process')) + },{"./ReactRootIndex":131,"./invariant":191,"_process":1}],113:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -16523,6 +16575,7 @@ ReactPerf.measureMethods(ReactMount, 'ReactMount', { module.exports = ReactMount; }).call(this,require('_process')) + },{"./DOMProperty":51,"./ReactBrowserEventEmitter":73,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactElementValidator":104,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMarkupChecksum":116,"./ReactPerf":122,"./ReactReconciler":129,"./ReactUpdateQueue":139,"./ReactUpdates":140,"./containsNode":164,"./emptyObject":171,"./getReactRootElementInContainer":185,"./instantiateReactComponent":190,"./invariant":191,"./setInnerHTML":205,"./shouldUpdateReactComponent":208,"./warning":212,"_process":1}],118:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -17093,6 +17146,7 @@ var ReactNativeComponent = { module.exports = ReactNativeComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./invariant":191,"_process":1}],121:[function(require,module,exports){ (function (process){ /** @@ -17205,6 +17259,7 @@ var ReactOwner = { module.exports = ReactOwner; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],122:[function(require,module,exports){ (function (process){ /** @@ -17309,6 +17364,7 @@ function _noMeasure(objName, fnName, func) { module.exports = ReactPerf; }).call(this,require('_process')) + },{"_process":1}],123:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -17447,6 +17503,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = ReactPropTypeLocationNames; }).call(this,require('_process')) + },{"_process":1}],125:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -18176,6 +18233,7 @@ var ReactReconciler = { module.exports = ReactReconciler; }).call(this,require('_process')) + },{"./ReactElementValidator":104,"./ReactRef":130,"_process":1}],130:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -18360,6 +18418,7 @@ module.exports = { }; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactInstanceHandles":112,"./ReactMarkupChecksum":116,"./ReactServerRenderingTransaction":133,"./emptyObject":171,"./instantiateReactComponent":190,"./invariant":191,"_process":1}],133:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -18608,6 +18667,7 @@ var ReactUpdates = require("./ReactUpdates"); var SyntheticEvent = require("./SyntheticEvent"); var assign = require("./Object.assign"); +var emptyObject = require("./emptyObject"); var topLevelTypes = EventConstants.topLevelTypes; @@ -18949,6 +19009,9 @@ assign( ); ReactShallowRenderer.prototype.render = function(element, context) { + if (!context) { + context = emptyObject; + } var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(); this._render(element, transaction, context); ReactUpdates.ReactReconcileTransaction.release(transaction); @@ -19089,7 +19152,7 @@ for (eventType in topLevelTypes) { module.exports = ReactTestUtils; -},{"./EventConstants":56,"./EventPluginHub":58,"./EventPropagators":61,"./Object.assign":69,"./React":71,"./ReactBrowserEventEmitter":73,"./ReactCompositeComponent":83,"./ReactElement":103,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMount":117,"./ReactUpdates":140,"./SyntheticEvent":149}],136:[function(require,module,exports){ +},{"./EventConstants":56,"./EventPluginHub":58,"./EventPropagators":61,"./Object.assign":69,"./React":71,"./ReactBrowserEventEmitter":73,"./ReactCompositeComponent":83,"./ReactElement":103,"./ReactEmptyComponent":105,"./ReactInstanceHandles":112,"./ReactInstanceMap":113,"./ReactMount":117,"./ReactUpdates":140,"./SyntheticEvent":149,"./emptyObject":171}],136:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. * All rights reserved. @@ -19834,6 +19897,7 @@ var ReactUpdateQueue = { module.exports = ReactUpdateQueue; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactCurrentOwner":85,"./ReactElement":103,"./ReactInstanceMap":113,"./ReactLifeCycle":114,"./ReactUpdates":140,"./invariant":191,"./warning":212,"_process":1}],140:[function(require,module,exports){ (function (process){ /** @@ -20116,6 +20180,7 @@ var ReactUpdates = { module.exports = ReactUpdates; }).call(this,require('_process')) + },{"./CallbackQueue":47,"./Object.assign":69,"./PooledClass":70,"./ReactCurrentOwner":85,"./ReactPerf":122,"./ReactReconciler":129,"./Transaction":157,"./invariant":191,"./warning":212,"_process":1}],141:[function(require,module,exports){ (function (process){ /** @@ -20172,6 +20237,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = React; }).call(this,require('_process')) + },{"./LinkedStateMixin":65,"./React":71,"./ReactCSSTransitionGroup":74,"./ReactComponentWithPureRenderMixin":82,"./ReactDefaultPerf":101,"./ReactFragment":109,"./ReactTestUtils":135,"./ReactTransitionGroup":138,"./ReactUpdates":140,"./cloneWithProps":163,"./cx":168,"./update":211,"_process":1}],142:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -20194,6 +20260,7 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var SVGDOMPropertyConfig = { Properties: { + clipPath: MUST_USE_ATTRIBUTE, cx: MUST_USE_ATTRIBUTE, cy: MUST_USE_ATTRIBUTE, d: MUST_USE_ATTRIBUTE, @@ -20239,6 +20306,7 @@ var SVGDOMPropertyConfig = { y: MUST_USE_ATTRIBUTE }, DOMAttributeNames: { + clipPath: 'clip-path', fillOpacity: 'fill-opacity', fontFamily: 'font-family', fontSize: 'font-size', @@ -20918,6 +20986,7 @@ var SimpleEventPlugin = { module.exports = SimpleEventPlugin; }).call(this,require('_process')) + },{"./EventConstants":56,"./EventPluginUtils":60,"./EventPropagators":61,"./SyntheticClipboardEvent":146,"./SyntheticDragEvent":148,"./SyntheticEvent":149,"./SyntheticFocusEvent":150,"./SyntheticKeyboardEvent":152,"./SyntheticMouseEvent":153,"./SyntheticTouchEvent":154,"./SyntheticUIEvent":155,"./SyntheticWheelEvent":156,"./getEventCharCode":178,"./invariant":191,"./keyOf":198,"./warning":212,"_process":1}],146:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -21878,6 +21947,7 @@ var Transaction = { module.exports = Transaction; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],158:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -21973,6 +22043,7 @@ function accumulateInto(current, next) { module.exports = accumulateInto; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],160:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22140,6 +22211,7 @@ function cloneWithProps(child, props) { module.exports = cloneWithProps; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactPropTransferer":123,"./keyOf":198,"./warning":212,"_process":1}],164:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22332,6 +22404,7 @@ function createFullPageComponent(tag) { module.exports = createFullPageComponent; }).call(this,require('_process')) + },{"./ReactClass":78,"./ReactElement":103,"./invariant":191,"_process":1}],167:[function(require,module,exports){ (function (process){ /** @@ -22422,6 +22495,7 @@ function createNodesFromMarkup(markup, handleScript) { module.exports = createNodesFromMarkup; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./createArrayFromMixed":165,"./getMarkupWrap":183,"./invariant":191,"_process":1}],168:[function(require,module,exports){ (function (process){ /** @@ -22478,6 +22552,7 @@ function cx(classNames) { module.exports = cx; }).call(this,require('_process')) + },{"./warning":212,"_process":1}],169:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22594,6 +22669,7 @@ if ("production" !== process.env.NODE_ENV) { module.exports = emptyObject; }).call(this,require('_process')) + },{"_process":1}],172:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -22707,6 +22783,7 @@ function findDOMNode(componentOrElement) { module.exports = findDOMNode; }).call(this,require('_process')) + },{"./ReactCurrentOwner":85,"./ReactInstanceMap":113,"./ReactMount":117,"./invariant":191,"./isNode":193,"./warning":212,"_process":1}],174:[function(require,module,exports){ (function (process){ /** @@ -22765,6 +22842,7 @@ function flattenChildren(children) { module.exports = flattenChildren; }).call(this,require('_process')) + },{"./traverseAllChildren":210,"./warning":212,"_process":1}],175:[function(require,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. @@ -23166,6 +23244,7 @@ var shouldWrap = { // Force wrapping for SVG elements because if they get created inside a <div>, // they will be initialized in the wrong namespace (and will not display). 'circle': true, + 'clipPath': true, 'defs': true, 'ellipse': true, 'g': true, @@ -23208,6 +23287,7 @@ var markupWrap = { 'th': trWrap, 'circle': svgWrap, + 'clipPath': svgWrap, 'defs': svgWrap, 'ellipse': svgWrap, 'g': svgWrap, @@ -23250,6 +23330,7 @@ function getMarkupWrap(nodeName) { module.exports = getMarkupWrap; }).call(this,require('_process')) + },{"./ExecutionEnvironment":62,"./invariant":191,"_process":1}],184:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -23555,6 +23636,7 @@ assign( function isInternalComponentType(type) { return ( typeof type === 'function' && + typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function' ); @@ -23648,6 +23730,7 @@ function instantiateReactComponent(node, parentCompositeType) { module.exports = instantiateReactComponent; }).call(this,require('_process')) + },{"./Object.assign":69,"./ReactCompositeComponent":83,"./ReactEmptyComponent":105,"./ReactNativeComponent":120,"./invariant":191,"./warning":212,"_process":1}],191:[function(require,module,exports){ (function (process){ /** @@ -23705,6 +23788,7 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; }).call(this,require('_process')) + },{"_process":1}],192:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -23961,6 +24045,7 @@ var keyMirror = function(obj) { module.exports = keyMirror; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],198:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -24123,6 +24208,7 @@ function onlyChild(children) { module.exports = onlyChild; }).call(this,require('_process')) + },{"./ReactElement":103,"./invariant":191,"_process":1}],202:[function(require,module,exports){ /** * Copyright 2013-2015, Facebook, Inc. @@ -24486,6 +24572,7 @@ function shouldUpdateReactComponent(prevElement, nextElement) { module.exports = shouldUpdateReactComponent; }).call(this,require('_process')) + },{"./warning":212,"_process":1}],209:[function(require,module,exports){ (function (process){ /** @@ -24558,6 +24645,7 @@ function toArray(obj) { module.exports = toArray; }).call(this,require('_process')) + },{"./invariant":191,"_process":1}],210:[function(require,module,exports){ (function (process){ /** @@ -24811,6 +24899,7 @@ function traverseAllChildren(children, callback, traverseContext) { module.exports = traverseAllChildren; }).call(this,require('_process')) + },{"./ReactElement":103,"./ReactFragment":109,"./ReactInstanceHandles":112,"./getIteratorFn":182,"./invariant":191,"./warning":212,"_process":1}],211:[function(require,module,exports){ (function (process){ /** @@ -24824,11 +24913,14 @@ module.exports = traverseAllChildren; * @providesModule update */ + /* global hasOwnProperty:true */ + 'use strict'; var assign = require("./Object.assign"); var keyOf = require("./keyOf"); var invariant = require("./invariant"); +var hasOwnProperty = {}.hasOwnProperty; function shallowCopy(x) { if (Array.isArray(x)) { @@ -24888,7 +24980,7 @@ function update(value, spec) { COMMAND_SET ) : invariant(typeof spec === 'object')); - if (spec.hasOwnProperty(COMMAND_SET)) { + if (hasOwnProperty.call(spec, COMMAND_SET)) { ("production" !== process.env.NODE_ENV ? invariant( Object.keys(spec).length === 1, 'Cannot have more than one key in an object with %s', @@ -24900,7 +24992,7 @@ function update(value, spec) { var nextValue = shallowCopy(value); - if (spec.hasOwnProperty(COMMAND_MERGE)) { + if (hasOwnProperty.call(spec, COMMAND_MERGE)) { var mergeObj = spec[COMMAND_MERGE]; ("production" !== process.env.NODE_ENV ? invariant( mergeObj && typeof mergeObj === 'object', @@ -24917,21 +25009,21 @@ function update(value, spec) { assign(nextValue, spec[COMMAND_MERGE]); } - if (spec.hasOwnProperty(COMMAND_PUSH)) { + if (hasOwnProperty.call(spec, COMMAND_PUSH)) { invariantArrayCase(value, spec, COMMAND_PUSH); spec[COMMAND_PUSH].forEach(function(item) { nextValue.push(item); }); } - if (spec.hasOwnProperty(COMMAND_UNSHIFT)) { + if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) { invariantArrayCase(value, spec, COMMAND_UNSHIFT); spec[COMMAND_UNSHIFT].forEach(function(item) { nextValue.unshift(item); }); } - if (spec.hasOwnProperty(COMMAND_SPLICE)) { + if (hasOwnProperty.call(spec, COMMAND_SPLICE)) { ("production" !== process.env.NODE_ENV ? invariant( Array.isArray(value), 'Expected %s target to be an array; got %s', @@ -24957,7 +25049,7 @@ function update(value, spec) { }); } - if (spec.hasOwnProperty(COMMAND_APPLY)) { + if (hasOwnProperty.call(spec, COMMAND_APPLY)) { ("production" !== process.env.NODE_ENV ? invariant( typeof spec[COMMAND_APPLY] === 'function', 'update(): expected spec of %s to be a function; got %s.', @@ -24979,6 +25071,7 @@ function update(value, spec) { module.exports = update; }).call(this,require('_process')) + },{"./Object.assign":69,"./invariant":191,"./keyOf":198,"_process":1}],212:[function(require,module,exports){ (function (process){ /** @@ -25042,9 +25135,10 @@ if ("production" !== process.env.NODE_ENV) { module.exports = warning; }).call(this,require('_process')) + },{"./emptyFunction":170,"_process":1}],"flux":[function(require,module,exports){ /** - * Copyright (c) 2014, Facebook, Inc. + * Copyright (c) 2014-2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the @@ -25052,11 +25146,11 @@ module.exports = warning; * of patent rights can be found in the PATENTS file in the same directory. */ -module.exports.Dispatcher = require('./lib/Dispatcher') +module.exports.Dispatcher = require('./lib/Dispatcher'); },{"./lib/Dispatcher":2}],"jquery":[function(require,module,exports){ /*! - * jQuery JavaScript Library v2.1.3 + * jQuery JavaScript Library v2.1.4 * http://jquery.com/ * * Includes Sizzle.js @@ -25066,7 +25160,7 @@ module.exports.Dispatcher = require('./lib/Dispatcher') * Released under the MIT license * http://jquery.org/license * - * Date: 2014-12-18T15:11Z + * Date: 2015-04-28T16:01Z */ (function( global, factory ) { @@ -25124,7 +25218,7 @@ var // Use the correct document accordingly with window argument (sandbox) document = window.document, - version = "2.1.3", + version = "2.1.4", // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -25588,7 +25682,12 @@ jQuery.each("Boolean Number String Function Array Date RegExp Object Error".spli }); function isArraylike( obj ) { - var length = obj.length, + + // Support: iOS 8.2 (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = "length" in obj && obj.length, type = jQuery.type( obj ); if ( type === "function" || jQuery.isWindow( obj ) ) { @@ -34265,10 +34364,10 @@ return jQuery; (function (global){ /** * @license - * lodash 3.6.0 (Custom Build) <https://lodash.com/> + * lodash 3.10.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern -d -o ./index.js` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> - * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> + * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ @@ -34278,7 +34377,7 @@ return jQuery; var undefined; /** Used as the semantic version number. */ - var VERSION = '3.6.0'; + var VERSION = '3.10.1'; /** Used to compose bitmasks for wrapper metadata. */ var BIND_FLAG = 1, @@ -34299,9 +34398,11 @@ return jQuery; var HOT_COUNT = 150, HOT_SPAN = 16; + /** Used as the size to enable large array optimizations. */ + var LARGE_ARRAY_SIZE = 200; + /** Used to indicate the type of lazy iteratees. */ - var LAZY_DROP_WHILE_FLAG = 0, - LAZY_FILTER_FLAG = 1, + var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2; /** Used as the `TypeError` message for "Functions" methods. */ @@ -34352,24 +34453,38 @@ return jQuery; reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; - /** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - */ - var reComboMarks = /[\u0300-\u036f\ufe20-\ufe23]/g; + /** Used to match property names within property paths. */ + var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; /** - * Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). + * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns) + * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern). */ + var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */ + var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect hexadecimal string values. */ - var reHexPrefix = /^0[xX]/; + var reHasHexPrefix = /^0[xX]/; /** Used to detect host constructors (Safari > 5). */ - var reHostCtor = /^\[object .+?Constructor\]$/; + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; @@ -34377,14 +34492,6 @@ return jQuery; /** Used to ensure capturing order of template delimiters. */ var reNoMatch = /($^)/; - /** - * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). - * In addition to special characters the forward slash is escaped to allow for - * easier `eval` use and `Function` compilation. - */ - var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, - reHasRegExpChars = RegExp(reRegExpChars.source); - /** Used to match unescaped characters in compiled string literals. */ var reUnescapedString = /['\n\r\u2028\u2029\\]/g; @@ -34396,26 +34503,13 @@ return jQuery; return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g'); }()); - /** Used to detect and test for whitespace. */ - var whitespace = ( - // Basic whitespace characters. - ' \t\x0b\f\xa0\ufeff' + - - // Line terminators. - '\n\r\u2028\u2029' + - - // Unicode category "Zs" space separators. - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - /** Used to assign default `context` object properties. */ var contextProps = [ 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array', 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number', - 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document', - 'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', - 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', - 'window' + 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite', + 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array', + 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap' ]; /** Used to make template sourceURLs easier to identify. */ @@ -34451,13 +34545,6 @@ return jQuery; cloneableTags[mapTag] = cloneableTags[setTag] = cloneableTags[weakMapTag] = false; - /** Used as an internal `_.debounce` options object by `_.throttle`. */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - /** Used to map latin-1 supplementary letters to basic latin letters. */ var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', @@ -34505,6 +34592,15 @@ return jQuery; 'object': true }; + /** Used to escape characters for inclusion in compiled regexes. */ + var regexpEscapes = { + '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34', + '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39', + 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46', + 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66', + 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78' + }; + /** Used to escape characters for inclusion in compiled string literals. */ var stringEscapes = { '\\': '\\', @@ -34522,7 +34618,7 @@ return jQuery; var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; /** Detect free variable `global` from Node.js. */ - var freeGlobal = freeExports && freeModule && typeof global == 'object' && global; + var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global; /** Detect free variable `self`. */ var freeSelf = objectTypes[typeof self] && self && self.Object && self; @@ -34536,7 +34632,7 @@ return jQuery; /** * Used as a reference to the global object. * - * The `this` value is used if it is the global object to avoid Greasemonkey's + * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this; @@ -34548,19 +34644,28 @@ return jQuery; * sorts them in ascending order without guaranteeing a stable sort. * * @private - * @param {*} value The value to compare to `other`. - * @param {*} other The value to compare to `value`. + * @param {*} value The value to compare. + * @param {*} other The other value to compare. * @returns {number} Returns the sort order indicator for `value`. */ function baseCompareAscending(value, other) { if (value !== other) { - var valIsReflexive = value === value, + var valIsNull = value === null, + valIsUndef = value === undefined, + valIsReflexive = value === value; + + var othIsNull = other === null, + othIsUndef = other === undefined, othIsReflexive = other === other; - if (value > other || !valIsReflexive || (typeof value == 'undefined' && othIsReflexive)) { + if ((value > other && !othIsNull) || !valIsReflexive || + (valIsNull && !othIsUndef && othIsReflexive) || + (valIsUndef && othIsReflexive)) { return 1; } - if (value < other || !othIsReflexive || (typeof other == 'undefined' && valIsReflexive)) { + if ((value < other && !valIsNull) || !othIsReflexive || + (othIsNull && !valIsUndef && valIsReflexive) || + (othIsUndef && valIsReflexive)) { return -1; } } @@ -34628,7 +34733,7 @@ return jQuery; } /** - * Converts `value` to a string if it is not one. An empty string is returned + * Converts `value` to a string if it's not one. An empty string is returned * for `null` or `undefined` values. * * @private @@ -34636,24 +34741,10 @@ return jQuery; * @returns {string} Returns the string. */ function baseToString(value) { - if (typeof value == 'string') { - return value; - } return value == null ? '' : (value + ''); } /** - * Used by `_.max` and `_.min` as the default callback for string values. - * - * @private - * @param {string} string The string to inspect. - * @returns {number} Returns the code unit of the first character of the string. - */ - function charAtCallback(string) { - return string.charCodeAt(0); - } - - /** * Used by `_.trim` and `_.trimLeft` to get the index of the first character * of `string` that is not found in `chars`. * @@ -34691,8 +34782,8 @@ return jQuery; * sort them in ascending order. * * @private - * @param {Object} object The object to compare to `other`. - * @param {Object} other The object to compare to `object`. + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. * @returns {number} Returns the sort order indicator for `object`. */ function compareAscending(object, other) { @@ -34700,16 +34791,16 @@ return jQuery; } /** - * Used by `_.sortByOrder` to compare multiple properties of each element - * in a collection and stable sort them in the following order: + * Used by `_.sortByOrder` to compare multiple properties of a value to another + * and stable sort them. * - * If orders is unspecified, sort in ascending order for all properties. - * Otherwise, for each property, sort in ascending order if its corresponding value in - * orders is true, and descending order if false. + * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise, + * a value is sorted in ascending order if its corresponding order is "asc", and + * descending if "desc". * * @private - * @param {Object} object The object to compare to `other`. - * @param {Object} other The object to compare to `object`. + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. * @param {boolean[]} orders The order to sort by for each property. * @returns {number} Returns the sort order indicator for `object`. */ @@ -34726,7 +34817,8 @@ return jQuery; if (index >= ordersLength) { return result; } - return result * (orders[index] ? 1 : -1); + var order = orders[index]; + return result * ((order === 'asc' || order === true) ? 1 : -1); } } // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications @@ -34762,8 +34854,25 @@ return jQuery; } /** - * Used by `_.template` to escape characters for inclusion in compiled - * string literals. + * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes. + * + * @private + * @param {string} chr The matched character to escape. + * @param {string} leadingChar The capture group for a leading character. + * @param {string} whitespaceChar The capture group for a whitespace character. + * @returns {string} Returns the escaped character. + */ + function escapeRegExpChar(chr, leadingChar, whitespaceChar) { + if (leadingChar) { + chr = regexpEscapes[chr]; + } else if (whitespaceChar) { + chr = stringEscapes[chr]; + } + return '\\' + chr; + } + + /** + * Used by `_.template` to escape characters for inclusion in compiled string literals. * * @private * @param {string} chr The matched character to escape. @@ -34974,15 +35083,9 @@ return jQuery; objectProto = Object.prototype, stringProto = String.prototype; - /** Used to detect DOM support. */ - var document = (document = context.window) && document.document; - /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; - /** Used to the length of n-tuples for `_.unzip`. */ - var getLength = baseProperty('length'); - /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; @@ -34990,56 +35093,42 @@ return jQuery; var idCounter = 0; /** - * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to restore the original `_` reference in `_.noConflict`. */ - var oldDash = context._; + var oldDash = root._; /** Used to detect if a method is native. */ - var reNative = RegExp('^' + - escapeRegExp(objToString) - .replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Native method references. */ - var ArrayBuffer = isNative(ArrayBuffer = context.ArrayBuffer) && ArrayBuffer, - bufferSlice = isNative(bufferSlice = ArrayBuffer && new ArrayBuffer(0).slice) && bufferSlice, - ceil = Math.ceil, + var ArrayBuffer = context.ArrayBuffer, clearTimeout = context.clearTimeout, - floor = Math.floor, - getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - push = arrayProto.push, + parseFloat = context.parseFloat, + pow = Math.pow, propertyIsEnumerable = objectProto.propertyIsEnumerable, - Set = isNative(Set = context.Set) && Set, + Set = getNative(context, 'Set'), setTimeout = context.setTimeout, splice = arrayProto.splice, - Uint8Array = isNative(Uint8Array = context.Uint8Array) && Uint8Array, - WeakMap = isNative(WeakMap = context.WeakMap) && WeakMap; - - /** Used to clone array buffers. */ - var Float64Array = (function() { - // Safari 5 errors when using an array buffer to initialize a typed array - // where the array buffer's `byteLength` is not a multiple of the typed - // array's `BYTES_PER_ELEMENT`. - try { - var func = isNative(func = context.Float64Array) && func, - result = new func(new ArrayBuffer(10), 0, 1) && func; - } catch(e) {} - return result; - }()); + Uint8Array = context.Uint8Array, + WeakMap = getNative(context, 'WeakMap'); /* Native method references for those with the same name as other `lodash` methods. */ - var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, - nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, + var nativeCeil = Math.ceil, + nativeCreate = getNative(Object, 'create'), + nativeFloor = Math.floor, + nativeIsArray = getNative(Array, 'isArray'), nativeIsFinite = context.isFinite, - nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, + nativeKeys = getNative(Object, 'keys'), nativeMax = Math.max, nativeMin = Math.min, - nativeNow = isNative(nativeNow = Date.now) && nativeNow, - nativeNumIsFinite = isNative(nativeNumIsFinite = Number.isFinite) && nativeNumIsFinite, + nativeNow = getNative(Date, 'now'), nativeParseInt = context.parseInt, nativeRandom = Math.random; @@ -35048,18 +35137,15 @@ return jQuery; POSITIVE_INFINITY = Number.POSITIVE_INFINITY; /** Used as references for the maximum length and index of an array. */ - var MAX_ARRAY_LENGTH = Math.pow(2, 32) - 1, - MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, + var MAX_ARRAY_LENGTH = 4294967295, + MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; - /** Used as the size, in bytes, of each `Float64Array` element. */ - var FLOAT64_BYTES_PER_ELEMENT = Float64Array ? Float64Array.BYTES_PER_ELEMENT : 0; - /** - * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ - var MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + var MAX_SAFE_INTEGER = 9007199254740991; /** Used to store function metadata. */ var metaMap = WeakMap && new WeakMap; @@ -35072,15 +35158,16 @@ return jQuery; /** * Creates a `lodash` object which wraps `value` to enable implicit chaining. * Methods that operate on and return arrays, collections, and functions can - * be chained together. Methods that return a boolean or single value will - * automatically end the chain returning the unwrapped value. Explicit chaining - * may be enabled using `_.chain`. The execution of chained methods is lazy, - * that is, execution is deferred until `_#value` is implicitly or explicitly - * called. + * be chained together. Methods that retrieve a single value or may return a + * primitive value will automatically end the chain returning the unwrapped + * value. Explicit chaining may be enabled using `_.chain`. The execution of + * chained methods is lazy, that is, execution is deferred until `_#value` + * is implicitly or explicitly called. * * Lazy evaluation allows several methods to support shortcut fusion. Shortcut - * fusion is an optimization that merges iteratees to avoid creating intermediate - * arrays and reduce the number of iteratee executions. + * fusion is an optimization strategy which merge iteratee calls; this can help + * to avoid the creation of intermediate data structures and greatly reduce the + * number of iteratee executions. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. @@ -35103,35 +35190,37 @@ return jQuery; * The chainable wrapper methods are: * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, - * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, - * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, - * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, - * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, - * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, - * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, - * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`, + * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`, + * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, + * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, + * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, + * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, + * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`, + * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, - * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, - * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, - * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, - * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, - * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`, + * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, + * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`, + * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, + * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`, + * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith` * * The wrapper methods that are **not** chainable by default are: - * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, - * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, - * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, - * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, - * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, - * `isFinite`,`isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, - * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, - * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, - * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, - * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, - * `startCase`, `startsWith`, `sum`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` + * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`, + * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, + * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, + * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, + * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, + * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`, + * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, + * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`, + * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`, + * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`, + * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, + * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, + * `unescape`, `uniqueId`, `value`, and `words` * * The wrapper method `sample` will return a wrapped value when `n` is provided, * otherwise an unwrapped value is returned. @@ -35146,8 +35235,8 @@ return jQuery; * var wrapped = _([1, 2, 3]); * * // returns an unwrapped value - * wrapped.reduce(function(sum, n) { - * return sum + n; + * wrapped.reduce(function(total, n) { + * return total + n; * }); * // => 6 * @@ -35206,57 +35295,6 @@ return jQuery; */ var support = lodash.support = {}; - (function(x) { - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but Firefox OS certified apps, older Opera mobile browsers, and - * the PlayStation 3; forced `false` for Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = /\bthis\b/.test(function() { return this; }); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if the DOM is supported. - * - * @memberOf _.support - * @type boolean - */ - try { - support.dom = document.createDocumentFragment().nodeType === 11; - } catch(e) { - support.dom = false; - } - - /** - * Detect if `arguments` object indexes are non-enumerable. - * - * In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object - * indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat - * `arguments` object indexes as non-enumerable and fail `hasOwnProperty` - * checks for indexes that exceed their function's formal parameters with - * associated values of `0`. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1); - } catch(e) { - support.nonEnumArgs = true; - } - }(0, 0)); - /** * By default, the template delimiters used by lodash are like those in * embedded Ruby (ERB). Change the following template settings to use @@ -35328,13 +35366,12 @@ return jQuery; */ function LazyWrapper(value) { this.__wrapped__ = value; - this.__actions__ = null; + this.__actions__ = []; this.__dir__ = 1; - this.__dropCount__ = 0; this.__filtered__ = false; - this.__iteratees__ = null; + this.__iteratees__ = []; this.__takeCount__ = POSITIVE_INFINITY; - this.__views__ = null; + this.__views__ = []; } /** @@ -35346,17 +35383,13 @@ return jQuery; * @returns {Object} Returns the cloned `LazyWrapper` object. */ function lazyClone() { - var actions = this.__actions__, - iteratees = this.__iteratees__, - views = this.__views__, - result = new LazyWrapper(this.__wrapped__); - - result.__actions__ = actions ? arrayCopy(actions) : null; + var result = new LazyWrapper(this.__wrapped__); + result.__actions__ = arrayCopy(this.__actions__); result.__dir__ = this.__dir__; result.__filtered__ = this.__filtered__; - result.__iteratees__ = iteratees ? arrayCopy(iteratees) : null; + result.__iteratees__ = arrayCopy(this.__iteratees__); result.__takeCount__ = this.__takeCount__; - result.__views__ = views ? arrayCopy(views) : null; + result.__views__ = arrayCopy(this.__views__); return result; } @@ -35389,22 +35422,25 @@ return jQuery; * @returns {*} Returns the unwrapped value. */ function lazyValue() { - var array = this.__wrapped__.value(); - if (!isArray(array)) { - return baseWrapperValue(array, this.__actions__); - } - var dir = this.__dir__, + var array = this.__wrapped__.value(), + dir = this.__dir__, + isArr = isArray(array), isRight = dir < 0, - view = getView(0, array.length, this.__views__), + arrLength = isArr ? array.length : 0, + view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : (start - 1), - takeCount = nativeMin(length, this.__takeCount__), iteratees = this.__iteratees__, - iterLength = iteratees ? iteratees.length : 0, + iterLength = iteratees.length, resIndex = 0, - result = []; + takeCount = nativeMin(length, this.__takeCount__); + + if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) { + return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__); + } + var result = []; outer: while (length-- && resIndex < takeCount) { @@ -35416,30 +35452,16 @@ return jQuery; while (++iterIndex < iterLength) { var data = iteratees[iterIndex], iteratee = data.iteratee, - type = data.type; + type = data.type, + computed = iteratee(value); - if (type == LAZY_DROP_WHILE_FLAG) { - if (data.done && (isRight ? (index > data.index) : (index < data.index))) { - data.count = 0; - data.done = false; - } - data.index = index; - if (!data.done) { - var limit = data.limit; - if (!(data.done = limit > -1 ? (data.count++ >= limit) : !iteratee(value))) { - continue outer; - } - } - } else { - var computed = iteratee(value); - if (type == LAZY_MAP_FLAG) { - value = computed; - } else if (!computed) { - if (type == LAZY_FILTER_FLAG) { - continue outer; - } else { - break outer; - } + if (type == LAZY_MAP_FLAG) { + value = computed; + } else if (!computed) { + if (type == LAZY_FILTER_FLAG) { + continue outer; + } else { + break outer; } } } @@ -35502,7 +35524,7 @@ return jQuery; } /** - * Adds `value` to `key` of the cache. + * Sets `value` to `key` of the cache. * * @private * @name set @@ -35572,6 +35594,30 @@ return jQuery; /*------------------------------------------------------------------------*/ /** + * Creates a new array joining `array` with `other`. + * + * @private + * @param {Array} array The array to join. + * @param {Array} other The other array to join. + * @returns {Array} Returns the new concatenated array. + */ + function arrayConcat(array, other) { + var index = -1, + length = array.length, + othIndex = -1, + othLength = other.length, + result = Array(length + othLength); + + while (++index < length) { + result[index] = array[index]; + } + while (++othIndex < othLength) { + result[index++] = other[othIndex]; + } + return result; + } + + /** * Copies the values of `source` to `array`. * * @private @@ -35654,6 +35700,35 @@ return jQuery; } /** + * A specialized version of `baseExtremum` for arrays which invokes `iteratee` + * with one argument: (value). + * + * @private + * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. + * @returns {*} Returns the extremum value. + */ + function arrayExtremum(array, iteratee, comparator, exValue) { + var index = -1, + length = array.length, + computed = exValue, + result = computed; + + while (++index < length) { + var value = array[index], + current = +iteratee(value); + + if (comparator(current, computed)) { + computed = current; + result = value; + } + } + return result; + } + + /** * A specialized version of `_.filter` for arrays without support for callback * shorthands and `this` binding. * @@ -35698,45 +35773,22 @@ return jQuery; } /** - * A specialized version of `_.max` for arrays without support for iteratees. + * Appends the elements of `values` to `array`. * * @private - * @param {Array} array The array to iterate over. - * @returns {*} Returns the maximum value. + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. */ - function arrayMax(array) { + function arrayPush(array, values) { var index = -1, - length = array.length, - result = NEGATIVE_INFINITY; + length = values.length, + offset = array.length; while (++index < length) { - var value = array[index]; - if (value > result) { - result = value; - } + array[offset + index] = values[index]; } - return result; - } - - /** - * A specialized version of `_.min` for arrays without support for iteratees. - * - * @private - * @param {Array} array The array to iterate over. - * @returns {*} Returns the minimum value. - */ - function arrayMin(array) { - var index = -1, - length = array.length, - result = POSITIVE_INFINITY; - - while (++index < length) { - var value = array[index]; - if (value < result) { - result = value; - } - } - return result; + return array; } /** @@ -35810,18 +35862,20 @@ return jQuery; } /** - * A specialized version of `_.sum` for arrays without support for iteratees. + * A specialized version of `_.sum` for arrays without support for callback + * shorthands and `this` binding.. * * @private * @param {Array} array The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. * @returns {number} Returns the sum. */ - function arraySum(array) { + function arraySum(array, iteratee) { var length = array.length, result = 0; while (length--) { - result += +array[length] || 0; + result += +iteratee(array[length]) || 0; } return result; } @@ -35835,13 +35889,13 @@ return jQuery; * @returns {*} Returns the value to assign to the destination object. */ function assignDefaults(objectValue, sourceValue) { - return typeof objectValue == 'undefined' ? sourceValue : objectValue; + return objectValue === undefined ? sourceValue : objectValue; } /** * Used by `_.template` to customize its `_.assign` use. * - * **Note:** This method is like `assignDefaults` except that it ignores + * **Note:** This function is like `assignDefaults` except that it ignores * inherited property values when checking if a property is `undefined`. * * @private @@ -35852,27 +35906,25 @@ return jQuery; * @returns {*} Returns the value to assign to the destination object. */ function assignOwnDefaults(objectValue, sourceValue, key, object) { - return (typeof objectValue == 'undefined' || !hasOwnProperty.call(object, key)) + return (objectValue === undefined || !hasOwnProperty.call(object, key)) ? sourceValue : objectValue; } /** - * The base implementation of `_.assign` without support for argument juggling, - * multiple sources, and `this` binding `customizer` functions. + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. - * @param {Function} [customizer] The function to customize assigning values. - * @returns {Object} Returns the destination object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. */ - function baseAssign(object, source, customizer) { - var props = keys(source); - if (!customizer) { - return baseCopy(source, object, props); - } + function assignWith(object, source, customizer) { var index = -1, + props = keys(source), length = props.length; while (++index < length) { @@ -35881,7 +35933,7 @@ return jQuery; result = customizer(value, source[key], key, object, source); if ((result === result ? (result !== value) : (value === value)) || - (typeof value == 'undefined' && !(key in object))) { + (value === undefined && !(key in object))) { object[key] = result; } } @@ -35889,47 +35941,60 @@ return jQuery; } /** - * The base implementation of `_.at` without support for strings and individual - * key arguments. + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return source == null + ? object + : baseCopy(source, keys(source), object); + } + + /** + * The base implementation of `_.at` without support for string collections + * and individual key arguments. * * @private * @param {Array|Object} collection The collection to iterate over. - * @param {number[]|string[]} [props] The property names or indexes of elements to pick. + * @param {number[]|string[]} props The property names or indexes of elements to pick. * @returns {Array} Returns the new array of picked elements. */ function baseAt(collection, props) { var index = -1, - length = collection.length, - isArr = isLength(length), + isNil = collection == null, + isArr = !isNil && isArrayLike(collection), + length = isArr ? collection.length : 0, propsLength = props.length, result = Array(propsLength); while(++index < propsLength) { var key = props[index]; if (isArr) { - key = parseFloat(key); result[index] = isIndex(key, length) ? collection[key] : undefined; } else { - result[index] = collection[key]; + result[index] = isNil ? undefined : collection[key]; } } return result; } /** - * Copies the properties of `source` to `object`. + * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. - * @param {Object} [object={}] The object to copy properties to. * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. * @returns {Object} Returns `object`. */ - function baseCopy(source, object, props) { - if (!props) { - props = object; - object = {}; - } + function baseCopy(source, props, object) { + object || (object = {}); + var index = -1, length = props.length; @@ -35953,7 +36018,7 @@ return jQuery; function baseCallback(func, thisArg, argCount) { var type = typeof func; if (type == 'function') { - return typeof thisArg == 'undefined' + return thisArg === undefined ? func : bindCallback(func, thisArg, argCount); } @@ -35963,9 +36028,9 @@ return jQuery; if (type == 'object') { return baseMatches(func); } - return typeof thisArg == 'undefined' - ? baseProperty(func + '') - : baseMatchesProperty(func + '', thisArg); + return thisArg === undefined + ? property(func) + : baseMatchesProperty(func, thisArg); } /** @@ -35987,7 +36052,7 @@ return jQuery; if (customizer) { result = object ? customizer(value, key, object) : customizer(value); } - if (typeof result != 'undefined') { + if (result !== undefined) { return result; } if (!isObject(value)) { @@ -36006,7 +36071,7 @@ return jQuery; if (tag == objectTag || tag == argsTag || (isFunc && !object)) { result = initCloneObject(isFunc ? {} : value); if (!isDeep) { - return baseCopy(value, result, keys(value)); + return baseAssign(result, value); } } else { return cloneableTags[tag] @@ -36014,7 +36079,7 @@ return jQuery; : (object ? value : {}); } } - // Check for circular references and return corresponding clone. + // Check for circular references and return its corresponding clone. stackA || (stackA = []); stackB || (stackB = []); @@ -36044,14 +36109,14 @@ return jQuery; * @returns {Object} Returns the new object. */ var baseCreate = (function() { - function Object() {} + function object() {} return function(prototype) { if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; + object.prototype = prototype; + var result = new object; + object.prototype = undefined; } - return result || context.Object(); + return result || {}; }; }()); @@ -36091,7 +36156,7 @@ return jQuery; var index = -1, indexOf = getIndexOf(), isCommon = indexOf == baseIndexOf, - cache = (isCommon && values.length >= 200) ? createCache(values) : null, + cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null, valuesLength = values.length; if (cache) { @@ -36161,6 +36226,32 @@ return jQuery; } /** + * Gets the extremum value of `collection` invoking `iteratee` for each value + * in `collection` to generate the criterion by which the value is ranked. + * The `iteratee` is invoked with three arguments: (value, index|key, collection). + * + * @private + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. + * @returns {*} Returns the extremum value. + */ + function baseExtremum(collection, iteratee, comparator, exValue) { + var computed = exValue, + result = computed; + + baseEach(collection, function(value, index, collection) { + var current = +iteratee(value, index, collection); + if (comparator(current, computed) || (current === exValue && current === result)) { + computed = current; + result = value; + } + }); + return result; + } + + /** * The base implementation of `_.fill` without an iteratee call guard. * * @private @@ -36177,7 +36268,7 @@ return jQuery; if (start < 0) { start = -start > length ? 0 : (length + start); } - end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); + end = (end === undefined || end > length) ? length : (+end || 0); if (end < 0) { end += length; } @@ -36239,33 +36330,29 @@ return jQuery; * * @private * @param {Array} array The array to flatten. - * @param {boolean} isDeep Specify a deep flatten. - * @param {boolean} isStrict Restrict flattening to arrays and `arguments` objects. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ - function baseFlatten(array, isDeep, isStrict) { + function baseFlatten(array, isDeep, isStrict, result) { + result || (result = []); + var index = -1, - length = array.length, - resIndex = -1, - result = []; + length = array.length; while (++index < length) { var value = array[index]; - - if (isObjectLike(value) && isLength(value.length) && (isArray(value) || isArguments(value))) { + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). - value = baseFlatten(value, isDeep, isStrict); - } - var valIndex = -1, - valLength = value.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[++resIndex] = value[valIndex]; + baseFlatten(value, isDeep, isStrict, result); + } else { + arrayPush(result, value); } } else if (!isStrict) { - result[++resIndex] = value; + result[result.length] = value; } } return result; @@ -36274,7 +36361,7 @@ return jQuery; /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for - * each property. Iterator functions may exit iteration early by explicitly + * each property. Iteratee functions may exit iteration early by explicitly * returning `false`. * * @private @@ -36361,6 +36448,32 @@ return jQuery; } /** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return (index && index == length) ? object : undefined; + } + + /** * The base implementation of `_.isEqual` without support for `this` binding * `customizer` functions. * @@ -36374,18 +36487,10 @@ return jQuery; * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) { - // Exit early for identical values. if (value === other) { - // Treat `+0` vs. `-0` as not equal. - return value !== 0 || (1 / value == 1 / other); + return true; } - var valType = typeof value, - othType = typeof other; - - // Exit early for unlike primitive values. - if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') || - value == null || other == null) { - // Return `false` unless both values are `NaN`. + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB); @@ -36428,28 +36533,24 @@ return jQuery; othIsArr = isTypedArray(other); } } - var objIsObj = (objTag == objectTag || (isLoose && objTag == funcTag)), - othIsObj = (othTag == objectTag || (isLoose && othTag == funcTag)), + var objIsObj = objTag == objectTag, + othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && !(objIsArr || objIsObj)) { return equalByTag(object, other, objTag); } - if (isLoose) { - if (!isSameTag && !(objIsObj && othIsObj)) { - return false; - } - } else { - var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + if (!isLoose) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - if (valWrapped || othWrapped) { - return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); - } - if (!isSameTag) { - return false; + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB); } } + if (!isSameTag) { + return false; + } // Assume cyclic values are equal. // For more information on detecting circular references see https://es5.github.io/#JO. stackA || (stackA = []); @@ -36479,42 +36580,44 @@ return jQuery; * * @private * @param {Object} object The object to inspect. - * @param {Array} props The source property names to match. - * @param {Array} values The source values to match. - * @param {Array} strictCompareFlags Strict comparison flags for source values. + * @param {Array} matchData The propery names, values, and compare flags to match. * @param {Function} [customizer] The function to customize comparing objects. * @returns {boolean} Returns `true` if `object` is a match, else `false`. */ - function baseIsMatch(object, props, values, strictCompareFlags, customizer) { - var index = -1, - length = props.length, + function baseIsMatch(object, matchData, customizer) { + var index = matchData.length, + length = index, noCustomizer = !customizer; - while (++index < length) { - if ((noCustomizer && strictCompareFlags[index]) - ? values[index] !== object[props[index]] - : !(props[index] in object) + if (object == null) { + return !length; + } + object = toObject(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) ) { return false; } } - index = -1; while (++index < length) { - var key = props[index], + data = matchData[index]; + var key = data[0], objValue = object[key], - srcValue = values[index]; + srcValue = data[1]; - if (noCustomizer && strictCompareFlags[index]) { - var result = typeof objValue != 'undefined' || (key in object); + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { + return false; + } } else { - result = customizer ? customizer(objValue, srcValue, key) : undefined; - if (typeof result == 'undefined') { - result = baseIsEqual(srcValue, objValue, customizer, true); + var result = customizer ? customizer(objValue, srcValue, key) : undefined; + if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) { + return false; } } - if (!result) { - return false; - } } return true; } @@ -36529,9 +36632,11 @@ return jQuery; * @returns {Array} Returns the new mapped array. */ function baseMap(collection, iteratee) { - var result = []; + var index = -1, + result = isArrayLike(collection) ? Array(collection.length) : []; + baseEach(collection, function(value, key, collection) { - result.push(iteratee(value, key, collection)); + result[++index] = iteratee(value, key, collection); }); return result; } @@ -36544,54 +36649,54 @@ return jQuery; * @returns {Function} Returns the new function. */ function baseMatches(source) { - var props = keys(source), - length = props.length; + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + var key = matchData[0][0], + value = matchData[0][1]; - if (!length) { - return constant(true); - } - if (length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); - }; - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = source[props[length]]; - values[length] = value; - strictCompareFlags[length] = isStrictComparable(value); + return function(object) { + if (object == null) { + return false; + } + return object[key] === value && (value !== undefined || (key in toObject(object))); + }; } return function(object) { - return object != null && baseIsMatch(toObject(object), props, values, strictCompareFlags); + return baseIsMatch(object, matchData); }; } /** - * The base implementation of `_.matchesProperty` which does not coerce `key` - * to a string. + * The base implementation of `_.matchesProperty` which does not clone `srcValue`. * * @private - * @param {string} key The key of the property to get. - * @param {*} value The value to compare. + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to compare. * @returns {Function} Returns the new function. */ - function baseMatchesProperty(key, value) { - if (isStrictComparable(value)) { - return function(object) { - return object != null && object[key] === value && - (typeof value != 'undefined' || (key in toObject(object))); - }; - } + function baseMatchesProperty(path, srcValue) { + var isArr = isArray(path), + isCommon = isKey(path) && isStrictComparable(srcValue), + pathKey = (path + ''); + + path = toPath(path); return function(object) { - return object != null && baseIsEqual(value, object[key], null, true); + if (object == null) { + return false; + } + var key = pathKey; + object = toObject(object); + if ((isArr || !isCommon) && !(key in object)) { + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + key = last(path); + object = toObject(object); + } + return object[key] === srcValue + ? (srcValue !== undefined || (key in object)) + : baseIsEqual(srcValue, object[key], undefined, true); }; } @@ -36602,32 +36707,40 @@ return jQuery; * @private * @param {Object} object The destination object. * @param {Object} source The source object. - * @param {Function} [customizer] The function to customize merging properties. + * @param {Function} [customizer] The function to customize merged values. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. - * @returns {Object} Returns the destination object. + * @returns {Object} Returns `object`. */ function baseMerge(object, source, customizer, stackA, stackB) { if (!isObject(object)) { return object; } - var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); - (isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { + var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)), + props = isSrcArr ? undefined : keys(source); + + arrayEach(props || source, function(srcValue, key) { + if (props) { + key = srcValue; + srcValue = source[key]; + } if (isObjectLike(srcValue)) { stackA || (stackA = []); stackB || (stackB = []); - return baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); + baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB); } - var value = object[key], - result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + else { + var value = object[key], + result = customizer ? customizer(value, srcValue, key, object, source) : undefined, + isCommon = result === undefined; - if (isCommon) { - result = srcValue; - } - if ((isSrcArr || typeof result != 'undefined') && - (isCommon || (result === result ? (result !== value) : (value === value)))) { - object[key] = result; + if (isCommon) { + result = srcValue; + } + if ((result !== undefined || (isSrcArr && !(key in object))) && + (isCommon || (result === result ? (result !== value) : (value === value)))) { + object[key] = result; + } } }); return object; @@ -36643,7 +36756,7 @@ return jQuery; * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize merging properties. + * @param {Function} [customizer] The function to customize merged values. * @param {Array} [stackA=[]] Tracks traversed source objects. * @param {Array} [stackB=[]] Associates values with source counterparts. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. @@ -36660,14 +36773,14 @@ return jQuery; } var value = object[key], result = customizer ? customizer(value, srcValue, key, object, source) : undefined, - isCommon = typeof result == 'undefined'; + isCommon = result === undefined; if (isCommon) { result = srcValue; - if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) { + if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) { result = isArray(value) ? value - : ((value && value.length) ? arrayCopy(value) : []); + : (isArrayLike(value) ? arrayCopy(value) : []); } else if (isPlainObject(srcValue) || isArguments(srcValue)) { result = isArguments(value) @@ -36692,7 +36805,7 @@ return jQuery; } /** - * The base implementation of `_.property` which does not coerce `key` to a string. + * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. @@ -36705,6 +36818,42 @@ return jQuery; } /** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new function. + */ + function basePropertyDeep(path) { + var pathKey = (path + ''); + path = toPath(path); + return function(object) { + return baseGet(object, path, pathKey); + }; + } + + /** + * The base implementation of `_.pullAt` without support for individual + * index arguments and capturing the removed elements. + * + * @private + * @param {Array} array The array to modify. + * @param {number[]} indexes The indexes of elements to remove. + * @returns {Array} Returns `array`. + */ + function basePullAt(array, indexes) { + var length = array ? indexes.length : 0; + while (length--) { + var index = indexes[length]; + if (index != previous && isIndex(index)) { + var previous = index; + splice.call(array, index, 1); + } + } + return array; + } + + /** * The base implementation of `_.random` without support for argument juggling * and returning floating-point numbers. * @@ -36714,7 +36863,7 @@ return jQuery; * @returns {number} Returns the random number. */ function baseRandom(min, max) { - return min + floor(nativeRandom() * (max - min + 1)); + return min + nativeFloor(nativeRandom() * (max - min + 1)); } /** @@ -36770,7 +36919,7 @@ return jQuery; if (start < 0) { start = -start > length ? 0 : (length + start); } - end = (typeof end == 'undefined' || end > length) ? length : (+end || 0); + end = (end === undefined || end > length) ? length : (+end || 0); if (end < 0) { end += length; } @@ -36829,23 +36978,19 @@ return jQuery; * * @private * @param {Array|Object|string} collection The collection to iterate over. - * @param {string[]} props The property names to sort by. - * @param {boolean[]} orders The sort orders of `props`. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. * @returns {Array} Returns the new sorted array. */ - function baseSortByOrder(collection, props, orders) { - var index = -1, - length = collection.length, - result = isLength(length) ? Array(length) : []; + function baseSortByOrder(collection, iteratees, orders) { + var callback = getCallback(), + index = -1; - baseEach(collection, function(value) { - var length = props.length, - criteria = Array(length); + iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); }); - while (length--) { - criteria[length] = value == null ? undefined : value[props[length]]; - } - result[++index] = { 'criteria': criteria, 'index': index, 'value': value }; + var result = baseMap(collection, function(value) { + var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); }); + return { 'criteria': criteria, 'index': ++index, 'value': value }; }); return baseSortBy(result, function(object, other) { @@ -36884,7 +37029,7 @@ return jQuery; indexOf = getIndexOf(), length = array.length, isCommon = indexOf == baseIndexOf, - isLarge = isCommon && length >= 200, + isLarge = isCommon && length >= LARGE_ARRAY_SIZE, seen = isLarge ? createCache() : null, result = []; @@ -36925,7 +37070,7 @@ return jQuery; /** * The base implementation of `_.values` and `_.valuesIn` which creates an * array of `object` property values corresponding to the property names - * returned by `keysFunc`. + * of `props`. * * @private * @param {Object} object The object to query. @@ -36983,11 +37128,8 @@ return jQuery; length = actions.length; while (++index < length) { - var args = [result], - action = actions[index]; - - push.apply(args, action.args); - result = action.func.apply(action.thisArg, args); + var action = actions[index]; + result = action.func.apply(action.thisArg, arrayPush([result], action.args)); } return result; } @@ -37012,7 +37154,7 @@ return jQuery; var mid = (low + high) >>> 1, computed = array[mid]; - if (retHighest ? (computed <= value) : (computed < value)) { + if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) { low = mid + 1; } else { high = mid; @@ -37042,17 +37184,23 @@ return jQuery; var low = 0, high = array ? array.length : 0, valIsNaN = value !== value, - valIsUndef = typeof value == 'undefined'; + valIsNull = value === null, + valIsUndef = value === undefined; while (low < high) { - var mid = floor((low + high) / 2), + var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), + isDef = computed !== undefined, isReflexive = computed === computed; if (valIsNaN) { var setLow = isReflexive || retHighest; + } else if (valIsNull) { + setLow = isReflexive && isDef && (retHighest || computed != null); } else if (valIsUndef) { - setLow = isReflexive && (retHighest || typeof computed != 'undefined'); + setLow = isReflexive && (retHighest || isDef); + } else if (computed == null) { + setLow = false; } else { setLow = retHighest ? (computed <= value) : (computed < value); } @@ -37079,7 +37227,7 @@ return jQuery; if (typeof func != 'function') { return identity; } - if (typeof thisArg == 'undefined') { + if (thisArg === undefined) { return func; } switch (argCount) { @@ -37109,26 +37257,11 @@ return jQuery; * @returns {ArrayBuffer} Returns the cloned array buffer. */ function bufferClone(buffer) { - return bufferSlice.call(buffer, 0); - } - if (!bufferSlice) { - // PhantomJS has `ArrayBuffer` and `Uint8Array` but not `Float64Array`. - bufferClone = !(ArrayBuffer && Uint8Array) ? constant(null) : function(buffer) { - var byteLength = buffer.byteLength, - floatLength = Float64Array ? floor(byteLength / FLOAT64_BYTES_PER_ELEMENT) : 0, - offset = floatLength * FLOAT64_BYTES_PER_ELEMENT, - result = new ArrayBuffer(byteLength); - - if (floatLength) { - var view = new Float64Array(result, 0, floatLength); - view.set(new Float64Array(buffer, 0, floatLength)); - } - if (byteLength != offset) { - view = new Uint8Array(result, offset); - view.set(new Uint8Array(buffer, offset)); - } - return result; - }; + var result = new ArrayBuffer(buffer.byteLength), + view = new Uint8Array(result); + + view.set(new Uint8Array(buffer)); + return result; } /** @@ -37147,7 +37280,7 @@ return jQuery; argsLength = nativeMax(args.length - holdersLength, 0), leftIndex = -1, leftLength = partials.length, - result = Array(argsLength + leftLength); + result = Array(leftLength + argsLength); while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; @@ -37183,23 +37316,18 @@ return jQuery; while (++argsIndex < argsLength) { result[argsIndex] = args[argsIndex]; } - var pad = argsIndex; + var offset = argsIndex; while (++rightIndex < rightLength) { - result[pad + rightIndex] = partials[rightIndex]; + result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { - result[pad + holders[holdersIndex]] = args[argsIndex++]; + result[offset + holders[holdersIndex]] = args[argsIndex++]; } return result; } /** - * Creates a function that aggregates a collection, creating an accumulator - * object composed from the results of running each element in the collection - * through an iteratee. - * - * **Note:** This function is used to create `_.countBy`, `_.groupBy`, `_.indexBy`, - * and `_.partition`. + * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function. * * @private * @param {Function} setter The function to set keys and values of the accumulator object. @@ -37229,48 +37357,39 @@ return jQuery; } /** - * Creates a function that assigns properties of source object(s) to a given - * destination object. - * - * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. + * Creates a `_.assign`, `_.defaults`, or `_.merge` function. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { - return function() { - var args = arguments, - length = args.length, - object = args[0]; - - if (length < 2 || object == null) { - return object; - } - var customizer = args[length - 2], - thisArg = args[length - 1], - guard = args[3]; + return restParam(function(object, sources) { + var index = -1, + length = object == null ? 0 : sources.length, + customizer = length > 2 ? sources[length - 2] : undefined, + guard = length > 2 ? sources[2] : undefined, + thisArg = length > 1 ? sources[length - 1] : undefined; - if (length > 3 && typeof customizer == 'function') { + if (typeof customizer == 'function') { customizer = bindCallback(customizer, thisArg, 5); length -= 2; } else { - customizer = (length > 2 && typeof thisArg == 'function') ? thisArg : null; + customizer = typeof thisArg == 'function' ? thisArg : undefined; length -= (customizer ? 1 : 0); } - if (guard && isIterateeCall(args[1], args[2], guard)) { - customizer = length == 3 ? null : customizer; - length = 2; + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; } - var index = 0; while (++index < length) { - var source = args[index]; + var source = sources[index]; if (source) { assigner(object, source, customizer); } } return object; - }; + }); } /** @@ -37283,7 +37402,7 @@ return jQuery; */ function createBaseEach(eachFunc, fromRight) { return function(collection, iteratee) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; if (!isLength(length)) { return eachFunc(collection, iteratee); } @@ -37349,9 +37468,9 @@ return jQuery; * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ - var createCache = !(nativeCreate && Set) ? constant(null) : function(values) { - return new SetCache(values); - }; + function createCache(values) { + return (nativeCreate && Set) ? new SetCache(values) : null; + } /** * Creates a function that produces compound words out of the words in a @@ -37385,8 +37504,22 @@ return jQuery; */ function createCtorWrapper(Ctor) { return function() { + // Use a `switch` statement to work with class constructors. + // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist + // for more details. + var args = arguments; + switch (args.length) { + case 0: return new Ctor; + case 1: return new Ctor(args[0]); + case 2: return new Ctor(args[0], args[1]); + case 3: return new Ctor(args[0], args[1], args[2]); + case 4: return new Ctor(args[0], args[1], args[2], args[3]); + case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]); + case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); + case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); + } var thisBinding = baseCreate(Ctor.prototype), - result = Ctor.apply(thisBinding, arguments); + result = Ctor.apply(thisBinding, args); // Mimic the constructor's `return` behavior. // See https://es5.github.io/#x13.2.2 for more details. @@ -37404,9 +37537,9 @@ return jQuery; function createCurry(flag) { function curryFunc(func, arity, guard) { if (guard && isIterateeCall(func, arity, guard)) { - arity = null; + arity = undefined; } - var result = createWrapper(func, flag, null, null, null, null, null, arity); + var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity); result.placeholder = curryFunc.placeholder; return result; } @@ -37414,35 +37547,46 @@ return jQuery; } /** + * Creates a `_.defaults` or `_.defaultsDeep` function. + * + * @private + * @param {Function} assigner The function to assign values. + * @param {Function} customizer The function to customize assigned values. + * @returns {Function} Returns the new defaults function. + */ + function createDefaults(assigner, customizer) { + return restParam(function(args) { + var object = args[0]; + if (object == null) { + return object; + } + args.push(customizer); + return assigner.apply(undefined, args); + }); + } + + /** * Creates a `_.max` or `_.min` function. * * @private - * @param {Function} arrayFunc The function to get the extremum value from an array. - * @param {boolean} [isMin] Specify returning the minimum, instead of the maximum, - * extremum value. + * @param {Function} comparator The function used to compare values. + * @param {*} exValue The initial extremum value. * @returns {Function} Returns the new extremum function. */ - function createExtremum(arrayFunc, isMin) { + function createExtremum(comparator, exValue) { return function(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } - var func = getCallback(), - noIteratee = iteratee == null; - - if (!(func === baseCallback && noIteratee)) { - noIteratee = false; - iteratee = func(iteratee, thisArg, 3); - } - if (noIteratee) { - var isArr = isArray(collection); - if (!isArr && isString(collection)) { - iteratee = charAtCallback; - } else { - return arrayFunc(isArr ? collection : toIterable(collection)); + iteratee = getCallback(iteratee, thisArg, 3); + if (iteratee.length == 1) { + collection = isArray(collection) ? collection : toIterable(collection); + var result = arrayExtremum(collection, iteratee, comparator, exValue); + if (!(collection.length && result === exValue)) { + return result; } } - return extremumBy(collection, iteratee, isMin); + return baseExtremum(collection, iteratee, comparator, exValue); }; } @@ -37462,7 +37606,7 @@ return jQuery; return index > -1 ? collection[index] : undefined; } return baseFind(collection, predicate, eachFunc); - } + }; } /** @@ -37505,11 +37649,8 @@ return jQuery; */ function createFlow(fromRight) { return function() { - var length = arguments.length; - if (!length) { - return function() { return arguments[0]; }; - } var wrapper, + length = arguments.length, index = fromRight ? length : -1, leftIndex = 0, funcs = Array(length); @@ -37519,28 +37660,32 @@ return jQuery; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - var funcName = wrapper ? '' : getFuncName(func); - wrapper = funcName == 'wrapper' ? new LodashWrapper([]) : wrapper; + if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') { + wrapper = new LodashWrapper([], true); + } } index = wrapper ? -1 : length; while (++index < length) { func = funcs[index]; - funcName = getFuncName(func); - var data = funcName == 'wrapper' ? getData(func) : null; - if (data && isLaziable(data[0])) { + var funcName = getFuncName(func), + data = funcName == 'wrapper' ? getData(func) : undefined; + + if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) { wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); } else { wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func); } } return function() { - var args = arguments; - if (wrapper && args.length == 1 && isArray(args[0])) { - return wrapper.plant(args[0]).value(); + var args = arguments, + value = args[0]; + + if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) { + return wrapper.plant(value).value(); } var index = 0, - result = funcs[index].apply(this, args); + result = length ? funcs[index].apply(this, args) : value; while (++index < length) { result = funcs[index].call(this, result); @@ -37560,7 +37705,7 @@ return jQuery; */ function createForEach(arrayFunc, eachFunc) { return function(collection, iteratee, thisArg) { - return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee) : eachFunc(collection, bindCallback(iteratee, thisArg, 3)); }; @@ -37575,7 +37720,7 @@ return jQuery; */ function createForIn(objectFunc) { return function(object, iteratee, thisArg) { - if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { + if (typeof iteratee != 'function' || thisArg !== undefined) { iteratee = bindCallback(iteratee, thisArg, 3); } return objectFunc(object, iteratee, keysIn); @@ -37591,7 +37736,7 @@ return jQuery; */ function createForOwn(objectFunc) { return function(object, iteratee, thisArg) { - if (typeof iteratee != 'function' || typeof thisArg != 'undefined') { + if (typeof iteratee != 'function' || thisArg !== undefined) { iteratee = bindCallback(iteratee, thisArg, 3); } return objectFunc(object, iteratee); @@ -37599,6 +37744,28 @@ return jQuery; } /** + * Creates a function for `_.mapKeys` or `_.mapValues`. + * + * @private + * @param {boolean} [isMapKeys] Specify mapping keys instead of values. + * @returns {Function} Returns the new map function. + */ + function createObjectMapper(isMapKeys) { + return function(object, iteratee, thisArg) { + var result = {}; + iteratee = getCallback(iteratee, thisArg, 3); + + baseForOwn(object, function(value, key, object) { + var mapped = iteratee(value, key, object); + key = isMapKeys ? mapped : key; + value = isMapKeys ? value : mapped; + result[key] = value; + }); + return result; + }; + } + + /** * Creates a function for `_.padLeft` or `_.padRight`. * * @private @@ -37608,7 +37775,7 @@ return jQuery; function createPadDir(fromRight) { return function(string, length, chars) { string = baseToString(string); - return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string)); + return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); }; } @@ -37622,7 +37789,7 @@ return jQuery; function createPartial(flag) { var partialFunc = restParam(function(func, partials) { var holders = replaceHolders(partials, partialFunc.placeholder); - return createWrapper(func, flag, null, partials, holders); + return createWrapper(func, flag, undefined, partials, holders); }); return partialFunc; } @@ -37638,7 +37805,7 @@ return jQuery; function createReduce(arrayFunc, eachFunc) { return function(collection, iteratee, accumulator, thisArg) { var initFromArray = arguments.length < 3; - return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection)) ? arrayFunc(collection, iteratee, accumulator, initFromArray) : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc); }; @@ -37667,10 +37834,8 @@ return jQuery; isBindKey = bitmask & BIND_KEY_FLAG, isCurry = bitmask & CURRY_FLAG, isCurryBound = bitmask & CURRY_BOUND_FLAG, - isCurryRight = bitmask & CURRY_RIGHT_FLAG; - - var Ctor = !isBindKey && createCtorWrapper(func), - key = func; + isCurryRight = bitmask & CURRY_RIGHT_FLAG, + Ctor = isBindKey ? undefined : createCtorWrapper(func); function wrapper() { // Avoid `arguments` object use disqualifying optimizations by @@ -37694,12 +37859,12 @@ return jQuery; length -= argsHolders.length; if (length < arity) { - var newArgPos = argPos ? arrayCopy(argPos) : null, + var newArgPos = argPos ? arrayCopy(argPos) : undefined, newArity = nativeMax(arity - length, 0), - newsHolders = isCurry ? argsHolders : null, - newHoldersRight = isCurry ? null : argsHolders, - newPartials = isCurry ? args : null, - newPartialsRight = isCurry ? null : args; + newsHolders = isCurry ? argsHolders : undefined, + newHoldersRight = isCurry ? undefined : argsHolders, + newPartials = isCurry ? args : undefined, + newPartialsRight = isCurry ? undefined : args; bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG); bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG); @@ -37717,17 +37882,18 @@ return jQuery; return result; } } - var thisBinding = isBind ? thisArg : this; - if (isBindKey) { - func = thisBinding[key]; - } + var thisBinding = isBind ? thisArg : this, + fn = isBindKey ? thisBinding[func] : func; + if (argPos) { args = reorder(args, argPos); } if (isAry && ary < args.length) { args.length = ary; } - var fn = (this && this !== root && this instanceof wrapper) ? (Ctor || createCtorWrapper(func)) : func; + if (this && this !== root && this instanceof wrapper) { + fn = Ctor || createCtorWrapper(func); + } return fn.apply(thisBinding, args); } return wrapper; @@ -37752,7 +37918,7 @@ return jQuery; } var padLength = length - strLength; chars = chars == null ? ' ' : (chars + ''); - return repeat(chars, ceil(padLength / chars.length)).slice(0, padLength); + return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength); } /** @@ -37778,7 +37944,7 @@ return jQuery; argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, - args = Array(argsLength + leftLength); + args = Array(leftLength + argsLength); while (++leftIndex < leftLength) { args[leftIndex] = partials[leftIndex]; @@ -37793,6 +37959,25 @@ return jQuery; } /** + * Creates a `_.ceil`, `_.floor`, or `_.round` function. + * + * @private + * @param {string} methodName The name of the `Math` method to use when rounding. + * @returns {Function} Returns the new round function. + */ + function createRound(methodName) { + var func = Math[methodName]; + return function(number, precision) { + precision = precision === undefined ? 0 : (+precision || 0); + if (precision) { + precision = pow(10, precision); + return func(number * precision) / precision; + } + return func(number); + }; + } + + /** * Creates a `_.sortedIndex` or `_.sortedLastIndex` function. * * @private @@ -37801,10 +37986,10 @@ return jQuery; */ function createSortedIndex(retHighest) { return function(array, value, iteratee, thisArg) { - var func = getCallback(iteratee); - return (func === baseCallback && iteratee == null) + var callback = getCallback(iteratee); + return (iteratee == null && callback === baseCallback) ? binaryIndex(array, value, retHighest) - : binaryIndexBy(array, value, func(iteratee, thisArg, 1), retHighest); + : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest); }; } @@ -37841,16 +38026,16 @@ return jQuery; var length = partials ? partials.length : 0; if (!length) { bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG); - partials = holders = null; + partials = holders = undefined; } length -= (holders ? holders.length : 0); if (bitmask & PARTIAL_RIGHT_FLAG) { var partialsRight = partials, holdersRight = holders; - partials = holders = null; + partials = holders = undefined; } - var data = isBindKey ? null : getData(func), + var data = isBindKey ? undefined : getData(func), newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity]; if (data) { @@ -37890,40 +38075,35 @@ return jQuery; function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) { var index = -1, arrLength = array.length, - othLength = other.length, - result = true; + othLength = other.length; if (arrLength != othLength && !(isLoose && othLength > arrLength)) { return false; } - // Deep compare the contents, ignoring non-numeric properties. - while (result && ++index < arrLength) { + // Ignore non-index properties. + while (++index < arrLength) { var arrValue = array[index], - othValue = other[index]; + othValue = other[index], + result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined; - result = undefined; - if (customizer) { - result = isLoose - ? customizer(othValue, arrValue, index) - : customizer(arrValue, othValue, index); + if (result !== undefined) { + if (result) { + continue; + } + return false; } - if (typeof result == 'undefined') { - // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { - var othIndex = othLength; - while (othIndex--) { - othValue = other[othIndex]; - result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); - if (result) { - break; - } - } - } else { - result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB); + })) { + return false; } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) { + return false; } } - return !!result; + return true; } /** @@ -37934,7 +38114,7 @@ return jQuery; * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private - * @param {Object} value The object to compare. + * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. @@ -37954,8 +38134,7 @@ return jQuery; // Treat `NaN` vs. `NaN` as equal. return (object != +object) ? other != +other - // But, treat `-0` vs. `+0` as not equal. - : (object == 0 ? ((1 / object) == (1 / other)) : object == +other); + : object == +other; case regexpTag: case stringTag: @@ -37989,29 +38168,22 @@ return jQuery; if (objLength != othLength && !isLoose) { return false; } - var skipCtor = isLoose, - index = -1; - + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + return false; + } + } + var skipCtor = isLoose; while (++index < objLength) { - var key = objProps[index], - result = isLoose ? key in other : hasOwnProperty.call(other, key); + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined; - if (result) { - var objValue = object[key], - othValue = other[key]; - - result = undefined; - if (customizer) { - result = isLoose - ? customizer(othValue, objValue, key) - : customizer(objValue, othValue, key); - } - if (typeof result == 'undefined') { - // Recursively compare objects (susceptible to call stack limits). - result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB); - } - } - if (!result) { + // Recursively compare objects (susceptible to call stack limits). + if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) { return false; } skipCtor || (skipCtor = key == 'constructor'); @@ -38032,34 +38204,6 @@ return jQuery; } /** - * Gets the extremum value of `collection` invoking `iteratee` for each value - * in `collection` to generate the criterion by which the value is ranked. - * The `iteratee` is invoked with three arguments: (value, index, collection). - * - * @private - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {boolean} [isMin] Specify returning the minimum, instead of the - * maximum, extremum value. - * @returns {*} Returns the extremum value. - */ - function extremumBy(collection, iteratee, isMin) { - var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY, - computed = exValue, - result = computed; - - baseEach(collection, function(value, index, collection) { - var current = iteratee(value, index, collection); - if ((isMin ? (current < computed) : (current > computed)) || - (current === exValue && current === result)) { - computed = current; - result = value; - } - }); - return result; - } - - /** * Gets the appropriate "callback" function. If the `_.callback` method is * customized this function returns the custom method, otherwise it returns * the `baseCallback` function. If arguments are provided the chosen function @@ -38092,29 +38236,20 @@ return jQuery; * @param {Function} func The function to query. * @returns {string} Returns the function name. */ - var getFuncName = (function() { - if (!support.funcNames) { - return constant(''); - } - if (constant.name == 'constant') { - return baseProperty('name'); - } - return function(func) { - var result = func.name, - array = realNames[result], - length = array ? array.length : 0; + function getFuncName(func) { + var result = func.name, + array = realNames[result], + length = array ? array.length : 0; - while (length--) { - var data = array[length], - otherFunc = data.func; - - if (otherFunc == null || otherFunc == func) { - return data.name; - } + while (length--) { + var data = array[length], + otherFunc = data.func; + if (otherFunc == null || otherFunc == func) { + return data.name; } - return result; - }; - }()); + } + return result; + } /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is @@ -38132,18 +38267,60 @@ return jQuery; } /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Gets the propery names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ + function getMatchData(object) { + var result = pairs(object), + length = result.length; + + while (length--) { + result[length][2] = isStrictComparable(result[length][1]); + } + return result; + } + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + /** * Gets the view, applying any `transforms` to the `start` and `end` positions. * * @private * @param {number} start The start of the view. * @param {number} end The end of the view. - * @param {Array} [transforms] The transformations to apply to the view. + * @param {Array} transforms The transformations to apply to the view. * @returns {Object} Returns an object containing the `start` and `end` * positions of the view. */ function getView(start, end, transforms) { var index = -1, - length = transforms ? transforms.length : 0; + length = transforms.length; while (++index < length) { var data = transforms[index], @@ -38199,7 +38376,6 @@ return jQuery; * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * - * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. @@ -38234,6 +38410,36 @@ return jQuery; } /** + * Invokes the method at `path` on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the method to invoke. + * @param {Array} args The arguments to invoke the method with. + * @returns {*} Returns the result of the invoked method. + */ + function invokePath(object, path, args) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + path = last(path); + } + var func = object == null ? object : object[path]; + return func == null ? undefined : func.apply(object, args); + } + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** * Checks if `value` is a valid array-like index. * * @private @@ -38242,7 +38448,7 @@ return jQuery; * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { - value = +value; + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } @@ -38261,13 +38467,9 @@ return jQuery; return false; } var type = typeof index; - if (type == 'number') { - var length = object.length, - prereq = isLength(length) && isIndex(index, length); - } else { - prereq = type == 'string' && index in object; - } - if (prereq) { + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { var other = object[index]; return value === value ? (value === other) : (other !== other); } @@ -38275,6 +38477,26 @@ return jQuery; } /** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ + function isKey(value, object) { + var type = typeof value; + if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') { + return true; + } + if (isArray(value)) { + return false; + } + var result = !reIsDeepProp.test(value); + return result || (object != null && value in toObject(object)); + } + + /** * Checks if `func` has a lazy counterpart. * * @private @@ -38283,13 +38505,21 @@ return jQuery; */ function isLaziable(func) { var funcName = getFuncName(func); - return !!funcName && func === lodash[funcName] && funcName in LazyWrapper.prototype; + if (!(funcName in LazyWrapper.prototype)) { + return false; + } + var other = lodash[funcName]; + if (func === other) { + return true; + } + var data = getData(other); + return !!data && func === data[0]; } /** * Checks if `value` is a valid array-like length. * - * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. @@ -38308,7 +38538,7 @@ return jQuery; * equality comparisons, else `false`. */ function isStrictComparable(value) { - return value === value && (value === 0 ? ((1 / value) > 0) : !isObject(value)); + return value === value && !isObject(value); } /** @@ -38382,8 +38612,20 @@ return jQuery; } /** - * A specialized version of `_.pick` that picks `object` properties specified - * by the `props` array. + * Used by `_.defaultsDeep` to customize its `_.merge` use. + * + * @private + * @param {*} objectValue The destination object property value. + * @param {*} sourceValue The source object property value. + * @returns {*} Returns the value to assign to the destination object. + */ + function mergeDefaults(objectValue, sourceValue) { + return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults); + } + + /** + * A specialized version of `_.pick` which picks `object` properties specified + * by `props`. * * @private * @param {Object} object The source object. @@ -38407,7 +38649,7 @@ return jQuery; } /** - * A specialized version of `_.pick` that picks `object` properties `predicate` + * A specialized version of `_.pick` which picks `object` properties `predicate` * returns truthy for. * * @private @@ -38481,53 +38723,20 @@ return jQuery; }()); /** - * A fallback implementation of `_.isPlainObject` which checks if `value` - * is an object created by the `Object` constructor or has a `[[Prototype]]` - * of `null`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var Ctor, - support = lodash.support; - - // Exit early for non `Object` objects. - if (!(isObjectLike(value) && objToString.call(value) == objectTag) || - (!hasOwnProperty.call(value, 'constructor') && - (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - var result; - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - baseForIn(value, function(subValue, key) { - result = key; - }); - return typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. * * @private - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function shimKeys(object) { var props = keysIn(object), propsLength = props.length, - length = propsLength && object.length, - support = lodash.support; + length = propsLength && object.length; - var allowIndexes = length && isLength(length) && - (isArray(object) || (support.nonEnumArgs && isArguments(object))); + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); var index = -1, result = []; @@ -38542,7 +38751,7 @@ return jQuery; } /** - * Converts `value` to an array-like object if it is not one. + * Converts `value` to an array-like object if it's not one. * * @private * @param {*} value The value to process. @@ -38552,14 +38761,14 @@ return jQuery; if (value == null) { return []; } - if (!isLength(value.length)) { + if (!isArrayLike(value)) { return values(value); } return isObject(value) ? value : Object(value); } /** - * Converts `value` to an object if it is not one. + * Converts `value` to an object if it's not one. * * @private * @param {*} value The value to process. @@ -38570,6 +38779,24 @@ return jQuery; } /** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ + function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; + } + + /** * Creates a clone of `wrapper`. * * @private @@ -38608,12 +38835,12 @@ return jQuery; if (guard ? isIterateeCall(array, size, guard) : size == null) { size = 1; } else { - size = nativeMax(+size || 1, 1); + size = nativeMax(nativeFloor(size) || 1, 1); } var index = 0, length = array ? array.length : 0, resIndex = -1, - result = Array(ceil(length / size)); + result = Array(nativeCeil(length / size)); while (index < length) { result[++resIndex] = baseSlice(array, index, (index += size)); @@ -38651,12 +38878,9 @@ return jQuery; } /** - * Creates an array excluding all values of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Creates an array of unique `array` values not included in the other + * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -38670,7 +38894,7 @@ return jQuery; * // => [1, 3] */ var difference = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return (isObjectLike(array) && isArrayLike(array)) ? baseDifference(array, baseFlatten(values, false, true)) : []; }); @@ -39065,13 +39289,10 @@ return jQuery; /** * Gets the index at which the first occurrence of `value` is found in `array` - * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, - * it is used as the offset from the end of `array`. If `array` is sorted - * providing `true` for `fromIndex` performs a faster binary search. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `array`. If `array` is sorted providing `true` for `fromIndex` + * performs a faster binary search. * * @static * @memberOf _ @@ -39102,10 +39323,9 @@ return jQuery; if (typeof fromIndex == 'number') { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; } else if (fromIndex) { - var index = binaryIndex(array, value), - other = array[index]; - - if (value === value ? (value === other) : (other !== other)) { + var index = binaryIndex(array, value); + if (index < length && + (value === value ? (value === array[index]) : (array[index] !== array[index]))) { return index; } return -1; @@ -39131,13 +39351,10 @@ return jQuery; } /** - * Creates an array of unique values in all provided arrays using `SameValueZero` + * Creates an array of unique values that are included in all of the provided + * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) * for equality comparisons. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @category Array @@ -39147,36 +39364,31 @@ return jQuery; * _.intersection([1, 2], [4, 2], [2, 1]); * // => [2] */ - function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = [], + var intersection = restParam(function(arrays) { + var othLength = arrays.length, + othIndex = othLength, + caches = Array(length), indexOf = getIndexOf(), - isCommon = indexOf == baseIndexOf; + isCommon = indexOf == baseIndexOf, + result = []; - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { - args.push(value); - caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); - } + while (othIndex--) { + var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : []; + caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null; } - argsLength = args.length; - var array = args[0], + var array = arrays[0], index = -1, length = array ? array.length : 0, - result = [], seen = caches[0]; outer: while (++index < length) { value = array[index]; if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { - argsIndex = argsLength; - while (--argsIndex) { - var cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + var othIndex = othLength; + while (--othIndex) { + var cache = caches[othIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) { continue outer; } } @@ -39187,7 +39399,7 @@ return jQuery; } } return result; - } + }); /** * Gets the last element of `array`. @@ -39260,14 +39472,11 @@ return jQuery; } /** - * Removes all provided values from `array` using `SameValueZero` for equality - * comparisons. + * Removes all provided values from `array` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * - * **Notes:** - * - Unlike `_.without`, this method mutates `array` - * - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except - * that `NaN` matches `NaN` + * **Note:** Unlike `_.without`, this method mutates `array`. * * @static * @memberOf _ @@ -39331,20 +39540,10 @@ return jQuery; * // => [10, 20] */ var pullAt = restParam(function(array, indexes) { - array || (array = []); indexes = baseFlatten(indexes); - var length = indexes.length, - result = baseAt(array, indexes); - - indexes.sort(baseCompareAscending); - while (length--) { - var index = parseFloat(indexes[length]); - if (index != previous && isIndex(index)) { - var previous = index; - splice.call(array, index, 1); - } - } + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); return result; }); @@ -39388,19 +39587,23 @@ return jQuery; * // => [2, 4] */ function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } var index = -1, - length = array ? array.length : 0, - result = []; + indexes = [], + length = array.length; predicate = getCallback(predicate, thisArg, 3); while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result.push(value); - splice.call(array, index--, 1); - length--; + indexes.push(index); } } + basePullAt(array, indexes); return result; } @@ -39425,7 +39628,7 @@ return jQuery; /** * Creates a slice of `array` from `start` up to, but not including, `end`. * - * **Note:** This function is used instead of `Array#slice` to support node + * **Note:** This method is used instead of `Array#slice` to support node * lists in IE < 9 and to ensure dense arrays are returned. * * @static @@ -39702,12 +39905,9 @@ return jQuery; } /** - * Creates an array of unique values, in order, of the provided arrays using - * `SameValueZero` for equality comparisons. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Creates an array of unique values, in order, from all of the provided arrays + * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -39724,12 +39924,14 @@ return jQuery; }); /** - * Creates a duplicate-value-free version of an array using `SameValueZero` - * for equality comparisons. Providing `true` for `isSorted` performs a faster - * search algorithm for sorted arrays. If an iteratee function is provided it - * is invoked for each value in the array to generate the criterion by which - * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked - * with three arguments: (value, index, array). + * Creates a duplicate-free version of an array, using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons, in which only the first occurence of each element + * is kept. Providing `true` for `isSorted` performs a faster search algorithm + * for sorted arrays. If an iteratee function is provided it is invoked for + * each element in the array to generate the criterion by which uniqueness + * is computed. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index, array). * * If a property name is provided for `iteratee` the created `_.property` * style callback returns the property value of the given element. @@ -39742,10 +39944,6 @@ return jQuery; * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. - * * @static * @memberOf _ * @alias unique @@ -39757,8 +39955,8 @@ return jQuery; * @returns {Array} Returns the new duplicate-value-free array. * @example * - * _.uniq([1, 2, 1]); - * // => [1, 2] + * _.uniq([2, 1, 2]); + * // => [2, 1] * * // using `isSorted` * _.uniq([1, 1, 2], true); @@ -39781,12 +39979,12 @@ return jQuery; } if (isSorted != null && typeof isSorted != 'boolean') { thisArg = iteratee; - iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted; isSorted = false; } - var func = getCallback(); - if (!(func === baseCallback && iteratee == null)) { - iteratee = func(iteratee, thisArg, 3); + var callback = getCallback(); + if (!(iteratee == null && callback === baseCallback)) { + iteratee = callback(iteratee, thisArg, 3); } return (isSorted && getIndexOf() == baseIndexOf) ? sortedUniq(array, iteratee) @@ -39795,7 +39993,7 @@ return jQuery; /** * This method is like `_.zip` except that it accepts an array of grouped - * elements and creates an array regrouping the elements to their pre-`_.zip` + * elements and creates an array regrouping the elements to their pre-zip * configuration. * * @static @@ -39812,10 +40010,19 @@ return jQuery; * // => [['fred', 'barney'], [30, 40], [true, false]] */ function unzip(array) { + if (!(array && array.length)) { + return []; + } var index = -1, - length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, - result = Array(length); + length = 0; + array = arrayFilter(array, function(group) { + if (isArrayLike(group)) { + length = nativeMax(group.length, length); + return true; + } + }); + var result = Array(length); while (++index < length) { result[index] = arrayMap(array, baseProperty(index)); } @@ -39823,12 +40030,44 @@ return jQuery; } /** - * Creates an array excluding all provided values using `SameValueZero` for - * equality comparisons. + * This method is like `_.unzip` except that it accepts an iteratee to specify + * how regrouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @param {Function} [iteratee] The function to combine regrouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of regrouped elements. + * @example * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * var zipped = _.zip([1, 2], [10, 20], [100, 200]); + * // => [[1, 10, 100], [2, 20, 200]] + * + * _.unzipWith(zipped, _.add); + * // => [3, 30, 300] + */ + function unzipWith(array, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var result = unzip(array); + if (iteratee == null) { + return result; + } + iteratee = bindCallback(iteratee, thisArg, 4); + return arrayMap(result, function(group) { + return arrayReduce(group, iteratee, undefined, true); + }); + } + + /** + * Creates an array excluding all provided values using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. * * @static * @memberOf _ @@ -39842,13 +40081,13 @@ return jQuery; * // => [3] */ var without = restParam(function(array, values) { - return (isArray(array) || isArguments(array)) + return isArrayLike(array) ? baseDifference(array, values) : []; }); /** - * Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) * of the provided arrays. * * @static @@ -39867,9 +40106,9 @@ return jQuery; while (++index < length) { var array = arguments[index]; - if (isArray(array) || isArguments(array)) { + if (isArrayLike(array)) { var result = result - ? baseDifference(result, array).concat(baseDifference(array, result)) + ? arrayPush(baseDifference(result, array), baseDifference(array, result)) : array; } } @@ -39933,6 +40172,38 @@ return jQuery; return result; } + /** + * This method is like `_.zip` except that it accepts an iteratee to specify + * how grouped values should be combined. The `iteratee` is bound to `thisArg` + * and invoked with four arguments: (accumulator, value, index, group). + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @param {Function} [iteratee] The function to combine grouped values. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zipWith([1, 2], [10, 20], [100, 200], _.add); + * // => [111, 222] + */ + var zipWith = restParam(function(arrays) { + var length = arrays.length, + iteratee = length > 2 ? arrays[length - 2] : undefined, + thisArg = length > 1 ? arrays[length - 1] : undefined; + + if (length > 2 && typeof iteratee == 'function') { + length -= 2; + } else { + iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined; + thisArg = undefined; + } + arrays.length = length; + return unzipWith(arrays, iteratee, thisArg); + }); + /*------------------------------------------------------------------------*/ /** @@ -40059,16 +40330,16 @@ return jQuery; * @example * * var array = [1, 2]; - * var wrapper = _(array).push(3); + * var wrapped = _(array).push(3); * * console.log(array); * // => [1, 2] * - * wrapper = wrapper.commit(); + * wrapped = wrapped.commit(); * console.log(array); * // => [1, 2, 3] * - * wrapper.last(); + * wrapped.last(); * // => 3 * * console.log(array); @@ -40079,6 +40350,33 @@ return jQuery; } /** + * Creates a new array joining a wrapped array with any additional arrays + * and/or values. + * + * @name concat + * @memberOf _ + * @category Chain + * @param {...*} [values] The values to concatenate. + * @returns {Array} Returns the new concatenated array. + * @example + * + * var array = [1]; + * var wrapped = _(array).concat(2, [3], [[4]]); + * + * console.log(wrapped.value()); + * // => [1, 2, 3, [4]] + * + * console.log(array); + * // => [1] + */ + var wrapperConcat = restParam(function(values) { + values = baseFlatten(values); + return this.thru(function(array) { + return arrayConcat(isArray(array) ? array : [toObject(array)], values); + }); + }); + + /** * Creates a clone of the chained sequence planting `value` as the wrapped value. * * @name plant @@ -40088,17 +40386,17 @@ return jQuery; * @example * * var array = [1, 2]; - * var wrapper = _(array).map(function(value) { + * var wrapped = _(array).map(function(value) { * return Math.pow(value, 2); * }); * * var other = [3, 4]; - * var otherWrapper = wrapper.plant(other); + * var otherWrapped = wrapped.plant(other); * - * otherWrapper.value(); + * otherWrapped.value(); * // => [9, 16] * - * wrapper.value(); + * wrapped.value(); * // => [1, 4] */ function wrapperPlant(value) { @@ -40141,15 +40439,20 @@ return jQuery; */ function wrapperReverse() { var value = this.__wrapped__; + + var interceptor = function(value) { + return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse(); + }; if (value instanceof LazyWrapper) { + var wrapped = value; if (this.__actions__.length) { - value = new LazyWrapper(this); + wrapped = new LazyWrapper(this); } - return new LodashWrapper(value.reverse(), this.__chain__); + wrapped = wrapped.reverse(); + wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined }); + return new LodashWrapper(wrapped, this.__chain__); } - return this.thru(function(value) { - return value.reverse(); - }); + return this.thru(interceptor); } /** @@ -40208,10 +40511,6 @@ return jQuery; * // => ['barney', 'pebbles'] */ var at = restParam(function(collection, props) { - var length = collection ? collection.length : 0; - if (isLength(length)) { - collection = toIterable(collection); - } return baseAt(collection, baseFlatten(props)); }); @@ -40311,9 +40610,9 @@ return jQuery; function every(collection, predicate, thisArg) { var func = isArray(collection) ? arrayEvery : baseEvery; if (thisArg && isIterateeCall(collection, predicate, thisArg)) { - predicate = null; + predicate = undefined; } - if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + if (typeof predicate != 'function' || thisArg !== undefined) { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); @@ -40483,10 +40782,10 @@ return jQuery; /** * Iterates over elements of `collection` invoking `iteratee` for each element. * The `iteratee` is bound to `thisArg` and invoked with three arguments: - * (value, index|key, collection). Iterator functions may exit iteration early + * (value, index|key, collection). Iteratee functions may exit iteration early * by explicitly returning `false`. * - * **Note:** As with other "Collections" methods, objects with a `length` property + * **Note:** As with other "Collections" methods, objects with a "length" property * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` * may be used for object iteration. * @@ -40584,13 +40883,10 @@ return jQuery; }); /** - * Checks if `value` is in `collection` using `SameValueZero` for equality - * comparisons. If `fromIndex` is negative, it is used as the offset from - * the end of `collection`. - * - * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) - * comparisons are like strict equality comparisons, e.g. `===`, except that - * `NaN` matches `NaN`. + * Checks if `value` is in `collection` using + * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) + * for equality comparisons. If `fromIndex` is negative, it is used as the offset + * from the end of `collection`. * * @static * @memberOf _ @@ -40616,22 +40912,19 @@ return jQuery; * // => true */ function includes(collection, target, fromIndex, guard) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; if (!isLength(length)) { collection = values(collection); length = collection.length; } - if (!length) { - return false; - } if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { fromIndex = 0; } else { fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); } return (typeof collection == 'string' || !isArray(collection) && isString(collection)) - ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) - : (getIndexOf(collection, target, fromIndex) > -1); + ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1) + : (!!length && getIndexOf(collection, target, fromIndex) > -1); } /** @@ -40685,16 +40978,16 @@ return jQuery; }); /** - * Invokes the method named by `methodName` on each element in `collection`, - * returning an array of the results of each invoked method. Any additional - * arguments are provided to each invoked method. If `methodName` is a function - * it is invoked for, and `this` bound to, each element in `collection`. + * Invokes the method at `path` of each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or + * @param {Array|Function|string} path The path of the method to invoke or * the function invoked per iteration. * @param {...*} [args] The arguments to invoke the method with. * @returns {Array} Returns the array of results. @@ -40706,15 +40999,15 @@ return jQuery; * _.invoke([123, 456], String.prototype.split, ''); * // => [['1', '2', '3'], ['4', '5', '6']] */ - var invoke = restParam(function(collection, methodName, args) { + var invoke = restParam(function(collection, path, args) { var index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = isLength(length) ? Array(length) : []; + isFunc = typeof path == 'function', + isProp = isKey(path), + result = isArrayLike(collection) ? Array(collection.length) : []; baseEach(collection, function(value) { - var func = isFunc ? methodName : (value != null && value[methodName]); - result[++index] = func ? func.apply(value, args) : undefined; + var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); }); return result; }); @@ -40735,14 +41028,15 @@ return jQuery; * callback returns `true` for elements that have the properties of the given * object, else `false`. * - * Many lodash methods are guarded to work as interatees for methods like + * Many lodash methods are guarded to work as iteratees for methods like * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. * * The guarded methods are: - * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, - * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, - * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, - * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, + * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, + * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, + * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, + * `sum`, `uniq`, and `words` * * @static * @memberOf _ @@ -40751,7 +41045,6 @@ return jQuery; * @param {Array|Object|string} collection The collection to iterate over. * @param {Function|Object|string} [iteratee=_.identity] The function invoked * per iteration. - * create a `_.property` or `_.matches` style callback respectively. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new mapped array. * @example @@ -40845,13 +41138,13 @@ return jQuery; }, function() { return [[], []]; }); /** - * Gets the value of `key` from all elements in `collection`. + * Gets the property value of `path` from all elements in `collection`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} key The key of the property to pluck. + * @param {Array|string} path The path of the property to pluck. * @returns {Array} Returns the property values. * @example * @@ -40867,8 +41160,8 @@ return jQuery; * _.pluck(userIndex, 'age'); * // => [36, 40] (iteration order is not guaranteed) */ - function pluck(collection, key) { - return map(collection, baseProperty(key)); + function pluck(collection, path) { + return map(collection, property(path)); } /** @@ -40879,11 +41172,12 @@ return jQuery; * value. The `iteratee` is bound to `thisArg` and invoked with four arguments: * (accumulator, value, index|key, collection). * - * Many lodash methods are guarded to work as interatees for methods like + * Many lodash methods are guarded to work as iteratees for methods like * `_.reduce`, `_.reduceRight`, and `_.transform`. * * The guarded methods are: - * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` + * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`, + * and `sortByOrder` * * @static * @memberOf _ @@ -40896,8 +41190,8 @@ return jQuery; * @returns {*} Returns the accumulated value. * @example * - * _.reduce([1, 2], function(sum, n) { - * return sum + n; + * _.reduce([1, 2], function(total, n) { + * return total + n; * }); * // => 3 * @@ -40931,23 +41225,12 @@ return jQuery; * }, []); * // => [4, 5, 2, 3, 0, 1] */ - var reduceRight = createReduce(arrayReduceRight, baseEachRight); + var reduceRight = createReduce(arrayReduceRight, baseEachRight); /** * The opposite of `_.filter`; this method returns the elements of `collection` * that `predicate` does **not** return truthy for. * - * If a property name is provided for `predicate` the created `_.property` - * style callback returns the property value of the given element. - * - * If a value is also provided for `thisArg` the created `_.matchesProperty` - * style callback returns `true` for elements that have a matching property - * value, else `false`. - * - * If an object is provided for `predicate` the created `_.matches` style - * callback returns `true` for elements that have the properties of the given - * object, else `false`. - * * @static * @memberOf _ * @category Collection @@ -41012,8 +41295,20 @@ return jQuery; var length = collection.length; return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; } - var result = shuffle(collection); - result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + var index = -1, + result = toArray(collection), + length = result.length, + lastIndex = length - 1; + + n = nativeMin(n < 0 ? 0 : (+n || 0), length); + while (++index < n) { + var rand = baseRandom(index, lastIndex), + value = result[rand]; + + result[rand] = result[index]; + result[index] = value; + } + result.length = n; return result; } @@ -41032,20 +41327,7 @@ return jQuery; * // => [4, 1, 3, 2] */ function shuffle(collection) { - collection = toIterable(collection); - - var index = -1, - length = collection.length, - result = Array(length); - - while (++index < length) { - var rand = baseRandom(0, index); - if (index != rand) { - result[index] = result[rand]; - } - result[rand] = collection[index]; - } - return result; + return sample(collection, POSITIVE_INFINITY); } /** @@ -41069,7 +41351,7 @@ return jQuery; * // => 7 */ function size(collection) { - var length = collection ? collection.length : 0; + var length = collection ? getLength(collection) : 0; return isLength(length) ? length : keys(collection).length; } @@ -41125,9 +41407,9 @@ return jQuery; function some(collection, predicate, thisArg) { var func = isArray(collection) ? arraySome : baseSome; if (thisArg && isIterateeCall(collection, predicate, thisArg)) { - predicate = null; + predicate = undefined; } - if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + if (typeof predicate != 'function' || thisArg !== undefined) { predicate = getCallback(predicate, thisArg, 3); } return func(collection, predicate); @@ -41155,9 +41437,8 @@ return jQuery; * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [iteratee=_.identity] The function - * invoked per iteration. If a property name or an object is provided it is - * used to create a `_.property` or `_.matches` style callback respectively. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Array} Returns the new sorted array. * @example @@ -41186,104 +41467,112 @@ return jQuery; if (collection == null) { return []; } - var index = -1, - length = collection.length, - result = isLength(length) ? Array(length) : []; - if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } + var index = -1; iteratee = getCallback(iteratee, thisArg, 3); - baseEach(collection, function(value, key, collection) { - result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; + + var result = baseMap(collection, function(value, key, collection) { + return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; }); return baseSortBy(result, compareAscending); } /** - * This method is like `_.sortBy` except that it sorts by property names - * instead of an iteratee function. + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(string|string[])} props The property names to sort by, - * specified as individual property names or arrays of property names. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. * @returns {Array} Returns the new sorted array. * @example * * var users = [ + * { 'user': 'fred', 'age': 48 }, * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 26 }, - * { 'user': 'fred', 'age': 30 } + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } * ]; * * _.map(_.sortByAll(users, ['user', 'age']), _.values); - * // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - function sortByAll() { - var args = arguments, - collection = args[0], - guard = args[3], - index = 0, - length = args.length - 1; - + var sortByAll = restParam(function(collection, iteratees) { if (collection == null) { return []; } - var props = Array(length); - while (index < length) { - props[index] = args[++index]; - } - if (guard && isIterateeCall(args[1], args[2], guard)) { - props = args[1]; + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; } - return baseSortByOrder(collection, baseFlatten(props), []); - } + return baseSortByOrder(collection, baseFlatten(iteratees), []); + }); /** * This method is like `_.sortByAll` except that it allows specifying the - * sort orders of the property names to sort by. A truthy value in `orders` - * will sort the corresponding property name in ascending order while a - * falsey value will sort it in descending order. + * sort orders of the iteratees to sort by. If `orders` is unspecified, all + * values are sorted in ascending order. Otherwise, a value is sorted in + * ascending order if its corresponding order is "asc", and descending if "desc". + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to iterate over. - * @param {string[]} props The property names to sort by. - * @param {boolean[]} orders The sort orders of `props`. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} [orders] The sort orders of `iteratees`. * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. * @returns {Array} Returns the new sorted array. * @example * * var users = [ - * { 'user': 'barney', 'age': 26 }, - * { 'user': 'fred', 'age': 40 }, - * { 'user': 'barney', 'age': 36 }, - * { 'user': 'fred', 'age': 30 } + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } * ]; * * // sort by `user` in ascending order and by `age` in descending order - * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); - * // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]] + * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] */ - function sortByOrder(collection, props, orders, guard) { + function sortByOrder(collection, iteratees, orders, guard) { if (collection == null) { return []; } - if (guard && isIterateeCall(props, orders, guard)) { - orders = null; + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = undefined; } - if (!isArray(props)) { - props = props == null ? [] : [props]; + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; } if (!isArray(orders)) { orders = orders == null ? [] : [orders]; } - return baseSortByOrder(collection, props, orders); + return baseSortByOrder(collection, iteratees, orders); } /** @@ -41400,10 +41689,10 @@ return jQuery; */ function ary(func, n, guard) { if (guard && isIterateeCall(func, n, guard)) { - n = null; + n = undefined; } n = (func && n == null) ? func.length : nativeMax(+n || 0, 0); - return createWrapper(func, ARY_FLAG, null, null, null, null, n); + return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n); } /** @@ -41436,8 +41725,9 @@ return jQuery; return function() { if (--n > 0) { result = func.apply(this, arguments); - } else { - func = null; + } + if (n <= 1) { + func = undefined; } return result; }; @@ -41451,7 +41741,7 @@ return jQuery; * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for partially applied arguments. * - * **Note:** Unlike native `Function#bind` this method does not set the `length` + * **Note:** Unlike native `Function#bind` this method does not set the "length" * property of bound functions. * * @static @@ -41493,7 +41783,7 @@ return jQuery; * of method names. If no method names are provided all enumerable function * properties, own and inherited, of `object` are bound. * - * **Note:** This method does not set the `length` property of bound functions. + * **Note:** This method does not set the "length" property of bound functions. * * @static * @memberOf _ @@ -41534,7 +41824,7 @@ return jQuery; * * This method differs from `_.bind` by allowing bound functions to reference * methods that may be redefined or don't yet exist. - * See [Peter Michaux's article](http://michaux.ca/articles/lazy-function-definition-pattern) + * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern) * for more details. * * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic @@ -41591,7 +41881,7 @@ return jQuery; * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds, * may be used as a placeholder for provided arguments. * - * **Note:** This method does not set the `length` property of curried functions. + * **Note:** This method does not set the "length" property of curried functions. * * @static * @memberOf _ @@ -41630,7 +41920,7 @@ return jQuery; * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for provided arguments. * - * **Note:** This method does not set the `length` property of curried functions. + * **Note:** This method does not set the "length" property of curried functions. * * @static * @memberOf _ @@ -41663,12 +41953,13 @@ return jQuery; var curryRight = createCurry(CURRY_RIGHT_FLAG); /** - * Creates a function that delays invoking `func` until after `wait` milliseconds - * have elapsed since the last time it was invoked. The created function comes - * with a `cancel` method to cancel delayed invocations. Provide an options - * object to indicate that `func` should be invoked on the leading and/or - * trailing edge of the `wait` timeout. Subsequent calls to the debounced - * function return the result of the last `func` invocation. + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed invocations. Provide an options object to indicate that `func` + * should be invoked on the leading and/or trailing edge of the `wait` timeout. + * Subsequent calls to the debounced function return the result of the last + * `func` invocation. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the debounced function is @@ -41744,9 +42035,9 @@ return jQuery; var leading = true; trailing = false; } else if (isObject(options)) { - leading = options.leading; + leading = !!options.leading; maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait); - trailing = 'trailing' in options ? options.trailing : trailing; + trailing = 'trailing' in options ? !!options.trailing : trailing; } function cancel() { @@ -41756,41 +42047,35 @@ return jQuery; if (maxTimeoutId) { clearTimeout(maxTimeoutId); } + lastCalled = 0; maxTimeoutId = timeoutId = trailingCall = undefined; } + function complete(isCalled, id) { + if (id) { + clearTimeout(id); + } + maxTimeoutId = timeoutId = trailingCall = undefined; + if (isCalled) { + lastCalled = now(); + result = func.apply(thisArg, args); + if (!timeoutId && !maxTimeoutId) { + args = thisArg = undefined; + } + } + } + function delayed() { var remaining = wait - (now() - stamp); if (remaining <= 0 || remaining > wait) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } + complete(trailingCall, maxTimeoutId); } else { timeoutId = setTimeout(delayed, remaining); } } function maxDelayed() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } + complete(trailing, timeoutId); } function debounced() { @@ -41830,7 +42115,7 @@ return jQuery; result = func.apply(thisArg, args); } if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; + args = thisArg = undefined; } return result; } @@ -41935,7 +42220,7 @@ return jQuery; * * **Note:** The cache is exposed as the `cache` property on the memoized * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the [`Map`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-map-prototype-object) + * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object) * method interface of `get`, `has`, and `set`. * * @static @@ -41982,14 +42267,14 @@ return jQuery; } var memoized = function() { var args = arguments, - cache = memoized.cache, - key = resolver ? resolver.apply(this, args) : args[0]; + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; if (cache.has(key)) { return cache.get(key); } var result = func.apply(this, args); - cache.set(key, result); + memoized.cache = cache.set(key, result); return result; }; memoized.cache = new memoize.Cache; @@ -41997,6 +42282,52 @@ return jQuery; } /** + * Creates a function that runs each argument through a corresponding + * transform function. + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to wrap. + * @param {...(Function|Function[])} [transforms] The functions to transform + * arguments, specified as individual functions or arrays of functions. + * @returns {Function} Returns the new function. + * @example + * + * function doubled(n) { + * return n * 2; + * } + * + * function square(n) { + * return n * n; + * } + * + * var modded = _.modArgs(function(x, y) { + * return [x, y]; + * }, square, doubled); + * + * modded(1, 2); + * // => [1, 4] + * + * modded(5, 10); + * // => [25, 20] + */ + var modArgs = restParam(function(func, transforms) { + transforms = baseFlatten(transforms); + if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var length = transforms.length; + return restParam(function(args) { + var index = nativeMin(args.length, length); + while (index--) { + args[index] = transforms[index](args[index]); + } + return func.apply(this, args); + }); + }); + + /** * Creates a function that negates the result of the predicate `func`. The * `func` predicate is invoked with the `this` binding and arguments of the * created function. @@ -42042,7 +42373,7 @@ return jQuery; * // `initialize` invokes `createApplication` once */ function once(func) { - return before(func, 2); + return before(2, func); } /** @@ -42053,7 +42384,7 @@ return jQuery; * The `_.partial.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * - * **Note:** This method does not set the `length` property of partially + * **Note:** This method does not set the "length" property of partially * applied functions. * * @static @@ -42086,7 +42417,7 @@ return jQuery; * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic * builds, may be used as a placeholder for partially applied arguments. * - * **Note:** This method does not set the `length` property of partially + * **Note:** This method does not set the "length" property of partially * applied functions. * * @static @@ -42141,7 +42472,7 @@ return jQuery; * // => [3, 6, 9] */ var rearg = restParam(function(func, indexes) { - return createWrapper(func, REARG_FLAG, null, null, null, baseFlatten(indexes)); + return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes)); }); /** @@ -42170,7 +42501,7 @@ return jQuery; if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } - start = nativeMax(typeof start == 'undefined' ? (func.length - 1) : (+start || 0), 0); + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); return function() { var args = arguments, index = -1, @@ -42236,12 +42567,12 @@ return jQuery; } /** - * Creates a function that only invokes `func` at most once per every `wait` - * milliseconds. The created function comes with a `cancel` method to cancel - * delayed invocations. Provide an options object to indicate that `func` - * should be invoked on the leading and/or trailing edge of the `wait` timeout. - * Subsequent calls to the throttled function return the result of the last - * `func` call. + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed invocations. Provide an options object to indicate + * that `func` should be invoked on the leading and/or trailing edge of the + * `wait` timeout. Subsequent calls to the throttled function return the + * result of the last `func` call. * * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked * on the trailing edge of the timeout only if the the throttled function is @@ -42287,10 +42618,7 @@ return jQuery; leading = 'leading' in options ? !!options.leading : leading; trailing = 'trailing' in options ? !!options.trailing : trailing; } - debounceOptions.leading = leading; - debounceOptions.maxWait = +wait; - debounceOptions.trailing = trailing; - return debounce(func, wait, debounceOptions); + return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing }); } /** @@ -42316,7 +42644,7 @@ return jQuery; */ function wrap(value, wrapper) { wrapper = wrapper == null ? identity : wrapper; - return createWrapper(wrapper, PARTIAL_FLAG, null, [value], []); + return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []); } /*------------------------------------------------------------------------*/ @@ -42381,8 +42709,9 @@ return jQuery; customizer = isDeep; isDeep = false; } - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); - return baseClone(value, isDeep, customizer); + return typeof customizer == 'function' + ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1)) + : baseClone(value, isDeep); } /** @@ -42431,8 +42760,57 @@ return jQuery; * // => 20 */ function cloneDeep(value, customizer, thisArg) { - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 1); - return baseClone(value, true, customizer); + return typeof customizer == 'function' + ? baseClone(value, true, bindCallback(customizer, thisArg, 1)) + : baseClone(value, true); + } + + /** + * Checks if `value` is greater than `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. + * @example + * + * _.gt(3, 1); + * // => true + * + * _.gt(3, 3); + * // => false + * + * _.gt(1, 3); + * // => false + */ + function gt(value, other) { + return value > other; + } + + /** + * Checks if `value` is greater than or equal to `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. + * @example + * + * _.gte(3, 1); + * // => true + * + * _.gte(3, 3); + * // => true + * + * _.gte(1, 3); + * // => false + */ + function gte(value, other) { + return value >= other; } /** @@ -42452,8 +42830,8 @@ return jQuery; * // => false */ function isArguments(value) { - var length = isObjectLike(value) ? value.length : undefined; - return isLength(length) && objToString.call(value) == argsTag; + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); } /** @@ -42533,14 +42911,7 @@ return jQuery; * // => false */ function isElement(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && - (objToString.call(value).indexOf('Element') > -1); - } - // Fallback for environments without DOM support. - if (!support.dom) { - isElement = function(value) { - return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); - }; + return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); } /** @@ -42574,10 +42945,9 @@ return jQuery; if (value == null) { return true; } - var length = value.length; - if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) || + if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) || (isObjectLike(value) && isFunction(value.splice)))) { - return !length; + return !value.length; } return !keys(value).length; } @@ -42597,10 +42967,11 @@ return jQuery; * * @static * @memberOf _ + * @alias eq * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparing values. + * @param {Function} [customizer] The function to customize value comparisons. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example @@ -42626,12 +42997,9 @@ return jQuery; * // => true */ function isEqual(value, other, customizer, thisArg) { - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); - if (!customizer && isStrictComparable(value) && isStrictComparable(other)) { - return value === other; - } + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; var result = customizer ? customizer(value, other) : undefined; - return typeof result == 'undefined' ? baseIsEqual(value, other, customizer) : !!result; + return result === undefined ? baseIsEqual(value, other, customizer) : !!result; } /** @@ -42658,7 +43026,7 @@ return jQuery; /** * Checks if `value` is a finite primitive number. * - * **Note:** This method is based on [`Number.isFinite`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.isfinite). + * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite). * * @static * @memberOf _ @@ -42682,9 +43050,9 @@ return jQuery; * _.isFinite(Infinity); * // => false */ - var isFinite = nativeNumIsFinite || function(value) { + function isFinite(value) { return typeof value == 'number' && nativeIsFinite(value); - }; + } /** * Checks if `value` is classified as a `Function` object. @@ -42702,12 +43070,12 @@ return jQuery; * _.isFunction(/abc/); * // => false */ - var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { + function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. - return objToString.call(value) == funcTag; - }; + return isObject(value) && objToString.call(value) == funcTag; + } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. @@ -42733,7 +43101,7 @@ return jQuery; // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; - return type == 'function' || (!!value && type == 'object'); + return !!value && (type == 'object' || type == 'function'); } /** @@ -42753,7 +43121,7 @@ return jQuery; * @category Lang * @param {Object} object The object to inspect. * @param {Object} source The object of property values to match. - * @param {Function} [customizer] The function to customize comparing values. + * @param {Function} [customizer] The function to customize value comparisons. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {boolean} Returns `true` if `object` is a match, else `false`. * @example @@ -42776,32 +43144,8 @@ return jQuery; * // => true */ function isMatch(object, source, customizer, thisArg) { - var props = keys(source), - length = props.length; - - if (!length) { - return true; - } - if (object == null) { - return false; - } - customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3); - if (!customizer && length == 1) { - var key = props[0], - value = source[key]; - - if (isStrictComparable(value)) { - return value === object[key] && (typeof value != 'undefined' || (key in toObject(object))); - } - } - var values = Array(length), - strictCompareFlags = Array(length); - - while (length--) { - value = values[length] = source[props[length]]; - strictCompareFlags[length] = isStrictComparable(value); - } - return baseIsMatch(toObject(object), props, values, strictCompareFlags, customizer); + customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined; + return baseIsMatch(object, getMatchData(source), customizer); } /** @@ -42855,10 +43199,10 @@ return jQuery; if (value == null) { return false; } - if (objToString.call(value) == funcTag) { - return reNative.test(fnToString.call(value)); + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); } - return isObjectLike(value) && reHostCtor.test(value); + return isObjectLike(value) && reIsHostCtor.test(value); } /** @@ -42937,17 +43281,26 @@ return jQuery; * _.isPlainObject(Object.create(null)); * // => true */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && objToString.call(value) == objectTag)) { + function isPlainObject(value) { + var Ctor; + + // Exit early for non `Object` objects. + if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) || + (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { return false; } - var valueOf = value.valueOf, - objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + baseForIn(value, function(subValue, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); + } /** * Checks if `value` is classified as a `RegExp` object. @@ -42966,7 +43319,7 @@ return jQuery; * // => false */ function isRegExp(value) { - return (isObjectLike(value) && objToString.call(value) == regexpTag) || false; + return isObject(value) && objToString.call(value) == regexpTag; } /** @@ -43026,7 +43379,55 @@ return jQuery; * // => false */ function isUndefined(value) { - return typeof value == 'undefined'; + return value === undefined; + } + + /** + * Checks if `value` is less than `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. + * @example + * + * _.lt(1, 3); + * // => true + * + * _.lt(3, 3); + * // => false + * + * _.lt(3, 1); + * // => false + */ + function lt(value, other) { + return value < other; + } + + /** + * Checks if `value` is less than or equal to `other`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. + * @example + * + * _.lte(1, 3); + * // => true + * + * _.lte(3, 3); + * // => true + * + * _.lte(3, 1); + * // => false + */ + function lte(value, other) { + return value <= other; } /** @@ -43045,7 +43446,7 @@ return jQuery; * // => [2, 3] */ function toArray(value) { - var length = value ? value.length : 0; + var length = value ? getLength(value) : 0; if (!isLength(length)) { return values(value); } @@ -43085,19 +43486,72 @@ return jQuery; /*------------------------------------------------------------------------*/ /** + * Recursively merges own enumerable properties of the source object(s), that + * don't resolve to `undefined` into the destination object. Subsequent sources + * overwrite property assignments of previous sources. If `customizer` is + * provided it is invoked to produce the merged values of the destination and + * source properties. If `customizer` returns `undefined` merging is handled + * by the method instead. The `customizer` is bound to `thisArg` and invoked + * with five arguments: (objectValue, sourceValue, key, object, source). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * var users = { + * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] + * }; + * + * var ages = { + * 'data': [{ 'age': 36 }, { 'age': 40 }] + * }; + * + * _.merge(users, ages); + * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } + * + * // using a customizer callback + * var object = { + * 'fruits': ['apple'], + * 'vegetables': ['beet'] + * }; + * + * var other = { + * 'fruits': ['banana'], + * 'vegetables': ['carrot'] + * }; + * + * _.merge(object, other, function(a, b) { + * if (_.isArray(a)) { + * return a.concat(b); + * } + * }); + * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } + */ + var merge = createAssigner(baseMerge); + + /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources overwrite property assignments of previous sources. * If `customizer` is provided it is invoked to produce the assigned values. * The `customizer` is bound to `thisArg` and invoked with five arguments: * (objectValue, sourceValue, key, object, source). * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign). + * * @static * @memberOf _ * @alias extend * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize assigning values. + * @param {Function} [customizer] The function to customize assigned values. * @param {*} [thisArg] The `this` binding of `customizer`. * @returns {Object} Returns `object`. * @example @@ -43107,13 +43561,17 @@ return jQuery; * * // using a customizer callback * var defaults = _.partialRight(_.assign, function(value, other) { - * return typeof value == 'undefined' ? other : value; + * return _.isUndefined(value) ? other : value; * }); * * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ - var assign = createAssigner(baseAssign); + var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); + }); /** * Creates an object that inherits from the given `prototype` object. If a @@ -43152,9 +43610,9 @@ return jQuery; function create(prototype, properties, guard) { var result = baseCreate(prototype); if (guard && isIterateeCall(prototype, properties, guard)) { - properties = null; + properties = undefined; } - return properties ? baseCopy(properties, result, keys(properties)) : result; + return properties ? baseAssign(result, properties) : result; } /** @@ -43162,6 +43620,8 @@ return jQuery; * object for all destination properties that resolve to `undefined`. Once a * property is set, additional values of the same property are ignored. * + * **Note:** This method mutates `object`. + * * @static * @memberOf _ * @category Object @@ -43173,14 +43633,27 @@ return jQuery; * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); * // => { 'user': 'barney', 'age': 36 } */ - var defaults = restParam(function(args) { - var object = args[0]; - if (object == null) { - return object; - } - args.push(assignDefaults); - return assign.apply(undefined, args); - }); + var defaults = createDefaults(assign, assignDefaults); + + /** + * This method is like `_.defaults` except that it recursively assigns + * default properties. + * + * **Note:** This method mutates `object`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @returns {Object} Returns `object`. + * @example + * + * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } }); + * // => { 'user': { 'name': 'barney', 'age': 36 } } + * + */ + var defaultsDeep = createDefaults(merge, mergeDefaults); /** * This method is like `_.find` except that it returns the key of the first @@ -43285,7 +43758,7 @@ return jQuery; /** * Iterates over own and inherited enumerable properties of an object invoking * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked - * with three arguments: (value, key, object). Iterator functions may exit + * with three arguments: (value, key, object). Iteratee functions may exit * iteration early by explicitly returning `false`. * * @static @@ -43341,7 +43814,7 @@ return jQuery; /** * Iterates over own enumerable properties of an object invoking `iteratee` * for each property. The `iteratee` is bound to `thisArg` and invoked with - * three arguments: (value, key, object). Iterator functions may exit iteration + * three arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static @@ -43414,24 +43887,72 @@ return jQuery; } /** - * Checks if `key` exists as a direct property of `object` instead of an - * inherited property. + * Gets the property value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. * * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. - * @param {string} key The key to check. - * @returns {boolean} Returns `true` if `key` is a direct property, else `false`. + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. * @example * - * var object = { 'a': 1, 'b': 2, 'c': 3 }; + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; * - * _.has(object, 'b'); + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); + return result === undefined ? defaultValue : result; + } + + /** + * Checks if `path` is a direct property. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @returns {boolean} Returns `true` if `path` is a direct property, else `false`. + * @example + * + * var object = { 'a': { 'b': { 'c': 3 } } }; + * + * _.has(object, 'a'); + * // => true + * + * _.has(object, 'a.b.c'); + * // => true + * + * _.has(object, ['a', 'b', 'c']); * // => true */ - function has(object, key) { - return object ? hasOwnProperty.call(object, key) : false; + function has(object, path) { + if (object == null) { + return false; + } + var result = hasOwnProperty.call(object, path); + if (!result && !isKey(path)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + if (object == null) { + return false; + } + path = last(path); + result = hasOwnProperty.call(object, path); + } + return result || (isLength(object.length) && isIndex(path, object.length) && + (isArray(object) || isArguments(object))); } /** @@ -43459,7 +43980,7 @@ return jQuery; */ function invert(object, multiValue, guard) { if (guard && isIterateeCall(object, multiValue, guard)) { - multiValue = null; + multiValue = undefined; } var index = -1, props = keys(object), @@ -43488,13 +44009,13 @@ return jQuery; * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the - * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * @@ -43512,12 +44033,9 @@ return jQuery; * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { - if (object) { - var Ctor = object.constructor, - length = object.length; - } + var Ctor = object == null ? undefined : object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || - (typeof object != 'function' && (length && isLength(length)))) { + (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; @@ -43531,7 +44049,7 @@ return jQuery; * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * @@ -43554,7 +44072,7 @@ return jQuery; } var length = object.length; length = (length && isLength(length) && - (isArray(object) || (support.nonEnumArgs && isArguments(object))) && length) || 0; + (isArray(object) || isArguments(object)) && length) || 0; var Ctor = object.constructor, index = -1, @@ -43575,6 +44093,28 @@ return jQuery; } /** + * The opposite of `_.mapValues`; this method creates an object with the + * same values as `object` and keys generated by running each own enumerable + * property of `object` through `iteratee`. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the new mapped object. + * @example + * + * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) { + * return key + value; + * }); + * // => { 'a1': 1, 'b2': 2 } + */ + var mapKeys = createObjectMapper(true); + + /** * Creates an object with the same keys as `object` and values generated by * running each own enumerable property of `object` through `iteratee`. The * iteratee function is bound to `thisArg` and invoked with three arguments: @@ -43615,74 +44155,11 @@ return jQuery; * _.mapValues(users, 'age'); * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) */ - function mapValues(object, iteratee, thisArg) { - var result = {}; - iteratee = getCallback(iteratee, thisArg, 3); - - baseForOwn(object, function(value, key, object) { - result[key] = iteratee(value, key, object); - }); - return result; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * overwrite property assignments of previous sources. If `customizer` is - * provided it is invoked to produce the merged values of the destination and - * source properties. If `customizer` returns `undefined` merging is handled - * by the method instead. The `customizer` is bound to `thisArg` and invoked - * with five arguments: (objectValue, sourceValue, key, object, source). - * - * @static - * @memberOf _ - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @param {Function} [customizer] The function to customize merging properties. - * @param {*} [thisArg] The `this` binding of `customizer`. - * @returns {Object} Returns `object`. - * @example - * - * var users = { - * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }] - * }; - * - * var ages = { - * 'data': [{ 'age': 36 }, { 'age': 40 }] - * }; - * - * _.merge(users, ages); - * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] } - * - * // using a customizer callback - * var object = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var other = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(object, other, function(a, b) { - * if (_.isArray(a)) { - * return a.concat(b); - * } - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } - */ - var merge = createAssigner(baseMerge); + var mapValues = createObjectMapper(); /** * The opposite of `_.pick`; this method creates an object composed of the * own and inherited enumerable properties of `object` that are not omitted. - * Property names may be specified as individual arguments or as arrays of - * property names. If `predicate` is provided it is invoked for each property - * of `object` omitting the properties `predicate` returns truthy for. The - * predicate is bound to `thisArg` and invoked with three arguments: - * (value, key, object). * * @static * @memberOf _ @@ -43724,7 +44201,7 @@ return jQuery; * @static * @memberOf _ * @category Object - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Array} Returns the new array of key-value pairs. * @example * @@ -43732,6 +44209,8 @@ return jQuery; * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed) */ function pairs(object) { + object = toObject(object); + var index = -1, props = keys(object), length = props.length, @@ -43780,41 +44259,93 @@ return jQuery; }); /** - * Resolves the value of property `key` on `object`. If the value of `key` is - * a function it is invoked with the `this` binding of `object` and its result - * is returned, else the property value is returned. If the property value is - * `undefined` the `defaultValue` is used in its place. + * This method is like `_.get` except that if the resolved value is a function + * it is invoked with the `this` binding of its parent object and its result + * is returned. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. - * @param {string} key The key of the property to resolve. - * @param {*} [defaultValue] The value returned if the property value - * resolves to `undefined`. + * @param {Array|string} path The path of the property to resolve. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. * @returns {*} Returns the resolved value. * @example * - * var object = { 'user': 'fred', 'age': _.constant(40) }; + * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] }; * - * _.result(object, 'user'); - * // => 'fred' + * _.result(object, 'a[0].b.c1'); + * // => 3 * - * _.result(object, 'age'); - * // => 40 + * _.result(object, 'a[0].b.c2'); + * // => 4 * - * _.result(object, 'status', 'busy'); - * // => 'busy' + * _.result(object, 'a.b.c', 'default'); + * // => 'default' * - * _.result(object, 'status', _.constant('busy')); - * // => 'busy' + * _.result(object, 'a.b.c', _.constant('default')); + * // => 'default' */ - function result(object, key, defaultValue) { - var value = object == null ? undefined : object[key]; - if (typeof value == 'undefined') { - value = defaultValue; + function result(object, path, defaultValue) { + var result = object == null ? undefined : object[path]; + if (result === undefined) { + if (object != null && !isKey(path, object)) { + path = toPath(path); + object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); + result = object == null ? undefined : object[last(path)]; + } + result = result === undefined ? defaultValue : result; + } + return isFunction(result) ? result.call(object) : result; + } + + /** + * Sets the property value of `path` on `object`. If a portion of `path` + * does not exist it is created. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to augment. + * @param {Array|string} path The path of the property to set. + * @param {*} value The value to set. + * @returns {Object} Returns `object`. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.set(object, 'a[0].b.c', 4); + * console.log(object.a[0].b.c); + * // => 4 + * + * _.set(object, 'x[0].y.z', 5); + * console.log(object.x[0].y.z); + * // => 5 + */ + function set(object, path, value) { + if (object == null) { + return object; + } + var pathKey = (path + ''); + path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path); + + var index = -1, + length = path.length, + lastIndex = length - 1, + nested = object; + + while (nested != null && ++index < length) { + var key = path[index]; + if (isObject(nested)) { + if (index == lastIndex) { + nested[key] = value; + } else if (nested[key] == null) { + nested[key] = isIndex(path[index + 1]) ? [] : {}; + } + } + nested = nested[key]; } - return isFunction(value) ? value.call(object) : value; + return object; } /** @@ -43822,7 +44353,7 @@ return jQuery; * `accumulator` object which is the result of running each of its own enumerable * properties through `iteratee`, with each invocation potentially mutating * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked - * with four arguments: (accumulator, value, key, object). Iterator functions + * with four arguments: (accumulator, value, key, object). Iteratee functions * may exit iteration early by explicitly returning `false`. * * @static @@ -43856,7 +44387,7 @@ return jQuery; if (isArr) { accumulator = isArray(object) ? new Ctor : []; } else { - accumulator = baseCreate(isFunction(Ctor) && Ctor.prototype); + accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined); } } else { accumulator = {}; @@ -43959,13 +44490,13 @@ return jQuery; */ function inRange(value, start, end) { start = +start || 0; - if (typeof end === 'undefined') { + if (end === undefined) { end = start; start = 0; } else { end = +end || 0; } - return value >= start && value < end; + return value >= nativeMin(start, end) && value < nativeMax(start, end); } /** @@ -43997,7 +44528,7 @@ return jQuery; */ function random(min, max, floating) { if (floating && isIterateeCall(min, max, floating)) { - max = floating = null; + max = floating = undefined; } var noMin = min == null, noMax = max == null; @@ -44090,7 +44621,7 @@ return jQuery; */ function deburr(string) { string = baseToString(string); - return string && string.replace(reLatin1, deburrLetter).replace(reComboMarks, ''); + return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); } /** @@ -44119,7 +44650,7 @@ return jQuery; target = (target + ''); var length = string.length; - position = typeof position == 'undefined' + position = position === undefined ? length : nativeMin(position < 0 ? 0 : (+position || 0), length); @@ -44135,15 +44666,16 @@ return jQuery; * use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like - * ">" and "/" don't require escaping in HTML and have no special meaning + * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in Internet Explorer < 9, they can break out - * of attribute values or HTML comments. See [#102](https://html5sec.org/#102), - * [#108](https://html5sec.org/#108), and [#133](https://html5sec.org/#133) of - * the [HTML5 Security Cheatsheet](https://html5sec.org/) for more details. + * of attribute values or HTML comments. See [#59](https://html5sec.org/#59), + * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and + * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) + * for more details. * * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) * to reduce XSS vectors. @@ -44183,8 +44715,8 @@ return jQuery; function escapeRegExp(string) { string = baseToString(string); return (string && reHasRegExpChars.test(string)) - ? string.replace(reRegExpChars, '\\$&') - : string; + ? string.replace(reRegExpChars, escapeRegExpChar) + : (string || '(?:)'); } /** @@ -44211,7 +44743,7 @@ return jQuery; }); /** - * Pads `string` on the left and right sides if it is shorter than `length`. + * Pads `string` on the left and right sides if it's shorter than `length`. * Padding characters are truncated if they can't be evenly divided by `length`. * * @static @@ -44241,15 +44773,15 @@ return jQuery; return string; } var mid = (length - strLength) / 2, - leftLength = floor(mid), - rightLength = ceil(mid); + leftLength = nativeFloor(mid), + rightLength = nativeCeil(mid); chars = createPadding('', rightLength, chars); return chars.slice(0, leftLength) + string + chars; } /** - * Pads `string` on the left side if it is shorter than `length`. Padding + * Pads `string` on the left side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static @@ -44273,7 +44805,7 @@ return jQuery; var padLeft = createPadDir(); /** - * Pads `string` on the right side if it is shorter than `length`. Padding + * Pads `string` on the right side if it's shorter than `length`. Padding * characters are truncated if they exceed `length`. * * @static @@ -44320,25 +44852,16 @@ return jQuery; * // => [6, 8, 10] */ function parseInt(string, radix, guard) { - if (guard && isIterateeCall(string, radix, guard)) { + // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. + // Chrome fails to trim leading <BOM> whitespace characters. + // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. + if (guard ? isIterateeCall(string, radix, guard) : radix == null) { radix = 0; + } else if (radix) { + radix = +radix; } - return nativeParseInt(string, radix); - } - // Fallback for environments with pre-ES5 implementations. - if (nativeParseInt(whitespace + '08') != 8) { - parseInt = function(string, radix, guard) { - // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`. - // Chrome fails to trim leading <BOM> whitespace characters. - // See https://code.google.com/p/v8/issues/detail?id=3109 for more details. - if (guard ? isIterateeCall(string, radix, guard) : radix == null) { - radix = 0; - } else if (radix) { - radix = +radix; - } - string = trim(string); - return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10)); - }; + string = trim(string); + return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10)); } /** @@ -44374,7 +44897,7 @@ return jQuery; if (n % 2) { result += string; } - n = floor(n / 2); + n = nativeFloor(n / 2); string += string; } while (n); @@ -44559,12 +45082,12 @@ return jQuery; var settings = lodash.templateSettings; if (otherOptions && isIterateeCall(string, options, otherOptions)) { - options = otherOptions = null; + options = otherOptions = undefined; } string = baseToString(string); - options = baseAssign(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); + options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults); - var imports = baseAssign(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), + var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); @@ -44754,7 +45277,7 @@ return jQuery; } /** - * Truncates `string` if it is longer than the given maximum string length. + * Truncates `string` if it's longer than the given maximum string length. * The last characters of the truncated string are replaced with the omission * string which defaults to "...". * @@ -44795,7 +45318,7 @@ return jQuery; */ function trunc(string, options, guard) { if (guard && isIterateeCall(string, options, guard)) { - options = null; + options = undefined; } var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; @@ -44890,7 +45413,7 @@ return jQuery; */ function words(string, pattern, guard) { if (guard && isIterateeCall(string, pattern, guard)) { - pattern = null; + pattern = undefined; } string = baseToString(string); return string.match(pattern || reWords) || []; @@ -44966,7 +45489,7 @@ return jQuery; */ function callback(func, thisArg, guard) { if (guard && isIterateeCall(func, thisArg, guard)) { - thisArg = null; + thisArg = undefined; } return isObjectLike(func) ? matches(func) @@ -45015,7 +45538,7 @@ return jQuery; } /** - * Creates a function which performs a deep comparison between a given object + * Creates a function that performs a deep comparison between a given object * and `source`, returning `true` if the given object has equivalent property * values, else `false`. * @@ -45044,7 +45567,7 @@ return jQuery; } /** - * Creates a function which compares the property value of `key` on a given + * Creates a function that compares the property value of `path` on a given * object to `value`. * * **Note:** This method supports comparing arrays, booleans, `Date` objects, @@ -45054,8 +45577,8 @@ return jQuery; * @static * @memberOf _ * @category Utility - * @param {string} key The key of the property to get. - * @param {*} value The value to compare. + * @param {Array|string} path The path of the property to get. + * @param {*} srcValue The value to match. * @returns {Function} Returns the new function. * @example * @@ -45067,22 +45590,79 @@ return jQuery; * _.find(users, _.matchesProperty('user', 'fred')); * // => { 'user': 'fred' } */ - function matchesProperty(key, value) { - return baseMatchesProperty(key + '', baseClone(value, true)); + function matchesProperty(path, srcValue) { + return baseMatchesProperty(path, baseClone(srcValue, true)); } /** + * Creates a function that invokes the method at `path` on a given object. + * Any additional arguments are provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Array|string} path The path of the method to invoke. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var objects = [ + * { 'a': { 'b': { 'c': _.constant(2) } } }, + * { 'a': { 'b': { 'c': _.constant(1) } } } + * ]; + * + * _.map(objects, _.method('a.b.c')); + * // => [2, 1] + * + * _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] + */ + var method = restParam(function(path, args) { + return function(object) { + return invokePath(object, path, args); + }; + }); + + /** + * The opposite of `_.method`; this method creates a function that invokes + * the method at a given path on `object`. Any additional arguments are + * provided to the invoked method. + * + * @static + * @memberOf _ + * @category Utility + * @param {Object} object The object to query. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Function} Returns the new function. + * @example + * + * var array = _.times(3, _.constant), + * object = { 'a': array, 'b': array, 'c': array }; + * + * _.map(['a[2]', 'c[0]'], _.methodOf(object)); + * // => [2, 0] + * + * _.map([['a', '2'], ['c', '0']], _.methodOf(object)); + * // => [2, 0] + */ + var methodOf = restParam(function(object, args) { + return function(path) { + return invokePath(object, path, args); + }; + }); + + /** * Adds all own enumerable function properties of a source object to the * destination object. If `object` is a function then methods are added to * its prototype as well. * - * **Note:** Use `_.runInContext` to create a pristine `lodash` function - * for mixins to avoid conflicts caused by modifying the original. + * **Note:** Use `_.runInContext` to create a pristine `lodash` function to + * avoid conflicts caused by modifying the original. * * @static * @memberOf _ * @category Utility - * @param {Function|Object} [object=this] object The destination object. + * @param {Function|Object} [object=lodash] The destination object. * @param {Object} source The object of functions to add. * @param {Object} [options] The options object. * @param {boolean} [options.chain=true] Specify whether the functions added @@ -45096,9 +45676,6 @@ return jQuery; * }); * } * - * // use `_.runInContext` to avoid conflicts (esp. in Node.js) - * var _ = require('lodash').runInContext(); - * * _.mixin({ 'vowels': vowels }); * _.vowels('fred'); * // => ['e'] @@ -45113,8 +45690,8 @@ return jQuery; function mixin(object, source, options) { if (options == null) { var isObj = isObject(source), - props = isObj && keys(source), - methodNames = props && props.length && baseFunctions(source, props); + props = isObj ? keys(source) : undefined, + methodNames = (props && props.length) ? baseFunctions(source, props) : undefined; if (!(methodNames ? methodNames.length : isObj)) { methodNames = false; @@ -45153,9 +45730,7 @@ return jQuery; result.__chain__ = chainAll; return result; } - var args = [this.value()]; - push.apply(args, arguments); - return func.apply(object, args); + return func.apply(object, arrayPush([this.value()], arguments)); }; }(func)); } @@ -45176,12 +45751,12 @@ return jQuery; * var lodash = _.noConflict(); */ function noConflict() { - context._ = oldDash; + root._ = oldDash; return this; } /** - * A no-operation function which returns `undefined` regardless of the + * A no-operation function that returns `undefined` regardless of the * arguments it receives. * * @static @@ -45199,61 +45774,61 @@ return jQuery; } /** - * Creates a function which returns the property value of `key` on a given object. + * Creates a function that returns the property value at `path` on a + * given object. * * @static * @memberOf _ * @category Utility - * @param {string} key The key of the property to get. + * @param {Array|string} path The path of the property to get. * @returns {Function} Returns the new function. * @example * - * var users = [ - * { 'user': 'fred' }, - * { 'user': 'barney' } + * var objects = [ + * { 'a': { 'b': { 'c': 2 } } }, + * { 'a': { 'b': { 'c': 1 } } } * ]; * - * var getName = _.property('user'); - * - * _.map(users, getName); - * // => ['fred', 'barney'] + * _.map(objects, _.property('a.b.c')); + * // => [2, 1] * - * _.pluck(_.sortBy(users, getName), 'user'); - * // => ['barney', 'fred'] + * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); + * // => [1, 2] */ - function property(key) { - return baseProperty(key + ''); + function property(path) { + return isKey(path) ? baseProperty(path) : basePropertyDeep(path); } /** - * The opposite of `_.property`; this method creates a function which returns - * the property value of a given key on `object`. + * The opposite of `_.property`; this method creates a function that returns + * the property value at a given path on `object`. * * @static * @memberOf _ * @category Utility - * @param {Object} object The object to inspect. + * @param {Object} object The object to query. * @returns {Function} Returns the new function. * @example * - * var object = { 'a': 3, 'b': 1, 'c': 2 }; + * var array = [0, 1, 2], + * object = { 'a': array, 'b': array, 'c': array }; * - * _.map(['a', 'c'], _.propertyOf(object)); - * // => [3, 2] + * _.map(['a[2]', 'c[0]'], _.propertyOf(object)); + * // => [2, 0] * - * _.sortBy(['a', 'b', 'c'], _.propertyOf(object)); - * // => ['b', 'c', 'a'] + * _.map([['a', '2'], ['c', '0']], _.propertyOf(object)); + * // => [2, 0] */ function propertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; + return function(path) { + return baseGet(object, toPath(path), path + ''); }; } /** * Creates an array of numbers (positive and/or negative) progressing from * `start` up to, but not including, `end`. If `end` is not specified it is - * set to `start` with `start` then set to `0`. If `start` is less than `end` + * set to `start` with `start` then set to `0`. If `end` is less than `start` * a zero-length range is created unless a negative `step` is specified. * * @static @@ -45285,7 +45860,7 @@ return jQuery; */ function range(start, end, step) { if (step && isIterateeCall(start, end, step)) { - end = step = null; + end = step = undefined; } start = +start || 0; step = step == null ? 1 : (+step || 0); @@ -45299,7 +45874,7 @@ return jQuery; // Use `Array(length)` so engines like Chakra and V8 avoid slower modes. // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details. var index = -1, - length = nativeMax(ceil((end - start) / (step || 1)), 0), + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); while (++index < length) { @@ -45329,7 +45904,7 @@ return jQuery; * _.times(3, function(n) { * mage.castSpell(n); * }); - * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively + * // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` * * _.times(3, function(n) { * this.cast(n); @@ -45337,7 +45912,7 @@ return jQuery; * // => also invokes `mage.castSpell(n)` three times */ function times(n, iteratee, thisArg) { - n = +n; + n = nativeFloor(n); // Exit early to avoid a JSC JIT bug in Safari 8 // where `Array(0)` is treated as `Array(1)`. @@ -45396,10 +45971,54 @@ return jQuery; * // => 10 */ function add(augend, addend) { - return augend + addend; + return (+augend || 0) + (+addend || 0); } /** + * Calculates `n` rounded up to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round up. + * @param {number} [precision=0] The precision to round up to. + * @returns {number} Returns the rounded up number. + * @example + * + * _.ceil(4.006); + * // => 5 + * + * _.ceil(6.004, 2); + * // => 6.01 + * + * _.ceil(6040, -2); + * // => 6100 + */ + var ceil = createRound('ceil'); + + /** + * Calculates `n` rounded down to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round down. + * @param {number} [precision=0] The precision to round down to. + * @returns {number} Returns the rounded down number. + * @example + * + * _.floor(4.006); + * // => 4 + * + * _.floor(0.046, 2); + * // => 0.04 + * + * _.floor(4060, -2); + * // => 4000 + */ + var floor = createRound('floor'); + + /** * Gets the maximum value of `collection`. If `collection` is empty or falsey * `-Infinity` is returned. If an iteratee function is provided it is invoked * for each value in `collection` to generate the criterion by which the value @@ -45446,7 +46065,7 @@ return jQuery; * _.max(users, 'age'); * // => { 'user': 'fred', 'age': 40 } */ - var max = createExtremum(arrayMax); + var max = createExtremum(gt, NEGATIVE_INFINITY); /** * Gets the minimum value of `collection`. If `collection` is empty or falsey @@ -45495,7 +46114,29 @@ return jQuery; * _.min(users, 'age'); * // => { 'user': 'barney', 'age': 36 } */ - var min = createExtremum(arrayMin, true); + var min = createExtremum(lt, POSITIVE_INFINITY); + + /** + * Calculates `n` rounded to `precision`. + * + * @static + * @memberOf _ + * @category Math + * @param {number} n The number to round. + * @param {number} [precision=0] The precision to round to. + * @returns {number} Returns the rounded number. + * @example + * + * _.round(4.006); + * // => 4 + * + * _.round(4.006, 2); + * // => 4.01 + * + * _.round(4060, -2); + * // => 4100 + */ + var round = createRound('round'); /** * Gets the sum of the values in `collection`. @@ -45531,17 +46172,11 @@ return jQuery; */ function sum(collection, iteratee, thisArg) { if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { - iteratee = null; + iteratee = undefined; } - var func = getCallback(), - noIteratee = iteratee == null; - - if (!(func === baseCallback && noIteratee)) { - noIteratee = false; - iteratee = func(iteratee, thisArg, 3); - } - return noIteratee - ? arraySum(isArray(collection) ? collection : toIterable(collection)) + iteratee = getCallback(iteratee, thisArg, 3); + return iteratee.length == 1 + ? arraySum(isArray(collection) ? collection : toIterable(collection), iteratee) : baseSum(collection, iteratee); } @@ -45588,6 +46223,7 @@ return jQuery; lodash.curryRight = curryRight; lodash.debounce = debounce; lodash.defaults = defaults; + lodash.defaultsDeep = defaultsDeep; lodash.defer = defer; lodash.delay = delay; lodash.difference = difference; @@ -45617,12 +46253,16 @@ return jQuery; lodash.keys = keys; lodash.keysIn = keysIn; lodash.map = map; + lodash.mapKeys = mapKeys; lodash.mapValues = mapValues; lodash.matches = matches; lodash.matchesProperty = matchesProperty; lodash.memoize = memoize; lodash.merge = merge; + lodash.method = method; + lodash.methodOf = methodOf; lodash.mixin = mixin; + lodash.modArgs = modArgs; lodash.negate = negate; lodash.omit = omit; lodash.once = once; @@ -45642,6 +46282,7 @@ return jQuery; lodash.remove = remove; lodash.rest = rest; lodash.restParam = restParam; + lodash.set = set; lodash.shuffle = shuffle; lodash.slice = slice; lodash.sortBy = sortBy; @@ -45662,6 +46303,7 @@ return jQuery; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; + lodash.unzipWith = unzipWith; lodash.values = values; lodash.valuesIn = valuesIn; lodash.where = where; @@ -45670,6 +46312,7 @@ return jQuery; lodash.xor = xor; lodash.zip = zip; lodash.zipObject = zipObject; + lodash.zipWith = zipWith; // Add aliases. lodash.backflow = flowRight; @@ -45695,6 +46338,7 @@ return jQuery; lodash.attempt = attempt; lodash.camelCase = camelCase; lodash.capitalize = capitalize; + lodash.ceil = ceil; lodash.clone = clone; lodash.cloneDeep = cloneDeep; lodash.deburr = deburr; @@ -45710,6 +46354,10 @@ return jQuery; lodash.findLastKey = findLastKey; lodash.findWhere = findWhere; lodash.first = first; + lodash.floor = floor; + lodash.get = get; + lodash.gt = gt; + lodash.gte = gte; lodash.has = has; lodash.identity = identity; lodash.includes = includes; @@ -45739,6 +46387,8 @@ return jQuery; lodash.kebabCase = kebabCase; lodash.last = last; lodash.lastIndexOf = lastIndexOf; + lodash.lt = lt; + lodash.lte = lte; lodash.max = max; lodash.min = min; lodash.noConflict = noConflict; @@ -45753,6 +46403,7 @@ return jQuery; lodash.reduceRight = reduceRight; lodash.repeat = repeat; lodash.result = result; + lodash.round = round; lodash.runInContext = runInContext; lodash.size = size; lodash.snakeCase = snakeCase; @@ -45775,6 +46426,7 @@ return jQuery; lodash.all = every; lodash.any = some; lodash.contains = includes; + lodash.eq = isEqual; lodash.detect = find; lodash.foldl = reduce; lodash.foldr = reduceRight; @@ -45822,48 +46474,20 @@ return jQuery; lodash[methodName].placeholder = lodash; }); - // Add `LazyWrapper` methods that accept an `iteratee` value. - arrayEach(['dropWhile', 'filter', 'map', 'takeWhile'], function(methodName, type) { - var isFilter = type != LAZY_MAP_FLAG, - isDropWhile = type == LAZY_DROP_WHILE_FLAG; - - LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { - var filtered = this.__filtered__, - result = (filtered && isDropWhile) ? new LazyWrapper(this) : this.clone(), - iteratees = result.__iteratees__ || (result.__iteratees__ = []); - - iteratees.push({ - 'done': false, - 'count': 0, - 'index': 0, - 'iteratee': getCallback(iteratee, thisArg, 1), - 'limit': -1, - 'type': type - }); - - result.__filtered__ = filtered || isFilter; - return result; - }; - }); - // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { - var whileName = methodName + 'While'; - LazyWrapper.prototype[methodName] = function(n) { - var filtered = this.__filtered__, - result = (filtered && !index) ? this.dropWhile() : this.clone(); + var filtered = this.__filtered__; + if (filtered && !index) { + return new LazyWrapper(this); + } + n = n == null ? 1 : nativeMax(nativeFloor(n) || 0, 0); - n = n == null ? 1 : nativeMax(floor(n) || 0, 0); + var result = this.clone(); if (filtered) { - if (index) { - result.__takeCount__ = nativeMin(result.__takeCount__, n); - } else { - last(result.__iteratees__).limit = n; - } + result.__takeCount__ = nativeMin(result.__takeCount__, n); } else { - var views = result.__views__ || (result.__views__ = []); - views.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); + result.__views__.push({ 'size': n, 'type': methodName + (result.__dir__ < 0 ? 'Right' : '') }); } return result; }; @@ -45871,9 +46495,18 @@ return jQuery; LazyWrapper.prototype[methodName + 'Right'] = function(n) { return this.reverse()[methodName](n).reverse(); }; + }); + + // Add `LazyWrapper` methods that accept an `iteratee` value. + arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) { + var type = index + 1, + isFilter = type != LAZY_MAP_FLAG; - LazyWrapper.prototype[methodName + 'RightWhile'] = function(predicate, thisArg) { - return this.reverse()[whileName](predicate, thisArg).reverse(); + LazyWrapper.prototype[methodName] = function(iteratee, thisArg) { + var result = this.clone(); + result.__iteratees__.push({ 'iteratee': getCallback(iteratee, thisArg, 1), 'type': type }); + result.__filtered__ = result.__filtered__ || isFilter; + return result; }; }); @@ -45891,14 +46524,14 @@ return jQuery; var dropName = 'drop' + (index ? '' : 'Right'); LazyWrapper.prototype[methodName] = function() { - return this[dropName](1); + return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); }; }); // Add `LazyWrapper` methods for `_.pluck` and `_.where`. arrayEach(['pluck', 'where'], function(methodName, index) { var operationName = index ? 'filter' : 'map', - createCallback = index ? baseMatches : baseProperty; + createCallback = index ? baseMatches : property; LazyWrapper.prototype[methodName] = function(value) { return this[operationName](createCallback(value)); @@ -45918,31 +46551,42 @@ return jQuery; LazyWrapper.prototype.slice = function(start, end) { start = start == null ? 0 : (+start || 0); - var result = start < 0 ? this.takeRight(-start) : this.drop(start); - if (typeof end != 'undefined') { + var result = this; + if (result.__filtered__ && (start > 0 || end < 0)) { + return new LazyWrapper(result); + } + if (start < 0) { + result = result.takeRight(-start); + } else if (start) { + result = result.drop(start); + } + if (end !== undefined) { end = (+end || 0); result = end < 0 ? result.dropRight(-end) : result.take(end - start); } return result; }; + LazyWrapper.prototype.takeRightWhile = function(predicate, thisArg) { + return this.reverse().takeWhile(predicate, thisArg).reverse(); + }; + LazyWrapper.prototype.toArray = function() { - return this.drop(0); + return this.take(POSITIVE_INFINITY); }; // Add `LazyWrapper` methods to `lodash.prototype`. baseForOwn(LazyWrapper.prototype, function(func, methodName) { - var lodashFunc = lodash[methodName]; + var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), + retUnwrapped = /^(?:first|last)$/.test(methodName), + lodashFunc = lodash[retUnwrapped ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName]; + if (!lodashFunc) { return; } - var checkIteratee = /^(?:filter|map|reject)|While$/.test(methodName), - retUnwrapped = /^(?:first|last)$/.test(methodName); - lodash.prototype[methodName] = function() { - var args = arguments, - length = args.length, + var args = retUnwrapped ? [1] : arguments, chainAll = this.__chain__, value = this.__wrapped__, isHybrid = !!this.__actions__.length, @@ -45951,28 +46595,30 @@ return jQuery; useLazy = isLazy || isArray(value); if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) { - // avoid lazy use if the iteratee has a `length` other than `1` + // Avoid lazy use if the iteratee has a "length" value other than `1`. isLazy = useLazy = false; } - var onlyLazy = isLazy && !isHybrid; - if (retUnwrapped && !chainAll) { - return onlyLazy - ? func.call(value) - : lodashFunc.call(lodash, this.value()); - } var interceptor = function(value) { - var otherArgs = [value]; - push.apply(otherArgs, args); - return lodashFunc.apply(lodash, otherArgs); + return (retUnwrapped && chainAll) + ? lodashFunc(value, 1)[0] + : lodashFunc.apply(undefined, arrayPush([value], args)); }; - if (useLazy) { - var wrapper = onlyLazy ? value : new LazyWrapper(this), - result = func.apply(wrapper, args); - if (!retUnwrapped && (isHybrid || result.__actions__)) { - var actions = result.__actions__ || (result.__actions__ = []); - actions.push({ 'func': thru, 'args': [interceptor], 'thisArg': lodash }); + var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined }, + onlyLazy = isLazy && !isHybrid; + + if (retUnwrapped && !chainAll) { + if (onlyLazy) { + value = value.clone(); + value.__actions__.push(action); + return func.call(value); } + return lodashFunc.call(undefined, this.value())[0]; + } + if (!retUnwrapped && useLazy) { + value = onlyLazy ? value : new LazyWrapper(this); + var result = func.apply(value, args); + result.__actions__.push(action); return new LodashWrapper(result, chainAll); } return this.thru(interceptor); @@ -45980,7 +46626,7 @@ return jQuery; }); // Add `Array` and `String` methods to `lodash.prototype`. - arrayEach(['concat', 'join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { + arrayEach(['join', 'pop', 'push', 'replace', 'shift', 'sort', 'splice', 'split', 'unshift'], function(methodName) { var func = (/^(?:replace|split)$/.test(methodName) ? stringProto : arrayProto)[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru', retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName); @@ -46007,7 +46653,7 @@ return jQuery; } }); - realNames[createHybridWrapper(null, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': null }]; + realNames[createHybridWrapper(undefined, BIND_KEY_FLAG).name] = [{ 'name': 'wrapper', 'func': undefined }]; // Add functions to the lazy wrapper. LazyWrapper.prototype.clone = lazyClone; @@ -46017,6 +46663,7 @@ return jQuery; // Add chaining functions to the `lodash` wrapper. lodash.prototype.chain = wrapperChain; lodash.prototype.commit = wrapperCommit; + lodash.prototype.concat = wrapperConcat; lodash.prototype.plant = wrapperPlant; lodash.prototype.reverse = wrapperReverse; lodash.prototype.toString = wrapperToString; @@ -46056,7 +46703,7 @@ return jQuery; if (moduleExports) { (freeModule.exports = _)._ = _; } - // Export for Narwhal or Rhino -require. + // Export for Rhino with CommonJS support. else { freeExports._ = _; } @@ -46068,40 +46715,46 @@ return jQuery; }.call(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + },{}],"react-router":[function(require,module,exports){ -"use strict"; +'use strict'; -exports.DefaultRoute = require("./components/DefaultRoute"); -exports.Link = require("./components/Link"); -exports.NotFoundRoute = require("./components/NotFoundRoute"); -exports.Redirect = require("./components/Redirect"); -exports.Route = require("./components/Route"); -exports.RouteHandler = require("./components/RouteHandler"); - -exports.HashLocation = require("./locations/HashLocation"); -exports.HistoryLocation = require("./locations/HistoryLocation"); -exports.RefreshLocation = require("./locations/RefreshLocation"); -exports.StaticLocation = require("./locations/StaticLocation"); -exports.TestLocation = require("./locations/TestLocation"); - -exports.ImitateBrowserBehavior = require("./behaviors/ImitateBrowserBehavior"); -exports.ScrollToTopBehavior = require("./behaviors/ScrollToTopBehavior"); - -exports.History = require("./History"); -exports.Navigation = require("./Navigation"); -exports.State = require("./State"); - -exports.createRoute = require("./Route").createRoute; -exports.createDefaultRoute = require("./Route").createDefaultRoute; -exports.createNotFoundRoute = require("./Route").createNotFoundRoute; -exports.createRedirect = require("./Route").createRedirect; -exports.createRoutesFromReactChildren = require("./createRoutesFromReactChildren"); -exports.create = require("./createRouter"); -exports.run = require("./runRouter"); -},{"./History":10,"./Navigation":12,"./Route":16,"./State":18,"./behaviors/ImitateBrowserBehavior":21,"./behaviors/ScrollToTopBehavior":22,"./components/DefaultRoute":24,"./components/Link":25,"./components/NotFoundRoute":26,"./components/Redirect":27,"./components/Route":28,"./components/RouteHandler":29,"./createRouter":30,"./createRoutesFromReactChildren":31,"./locations/HashLocation":34,"./locations/HistoryLocation":35,"./locations/RefreshLocation":36,"./locations/StaticLocation":37,"./locations/TestLocation":38,"./runRouter":39}],"react/addons":[function(require,module,exports){ +exports.DefaultRoute = require('./components/DefaultRoute'); +exports.Link = require('./components/Link'); +exports.NotFoundRoute = require('./components/NotFoundRoute'); +exports.Redirect = require('./components/Redirect'); +exports.Route = require('./components/Route'); +exports.ActiveHandler = require('./components/RouteHandler'); +exports.RouteHandler = exports.ActiveHandler; + +exports.HashLocation = require('./locations/HashLocation'); +exports.HistoryLocation = require('./locations/HistoryLocation'); +exports.RefreshLocation = require('./locations/RefreshLocation'); +exports.StaticLocation = require('./locations/StaticLocation'); +exports.TestLocation = require('./locations/TestLocation'); + +exports.ImitateBrowserBehavior = require('./behaviors/ImitateBrowserBehavior'); +exports.ScrollToTopBehavior = require('./behaviors/ScrollToTopBehavior'); + +exports.History = require('./History'); +exports.Navigation = require('./Navigation'); +exports.State = require('./State'); + +exports.createRoute = require('./Route').createRoute; +exports.createDefaultRoute = require('./Route').createDefaultRoute; +exports.createNotFoundRoute = require('./Route').createNotFoundRoute; +exports.createRedirect = require('./Route').createRedirect; +exports.createRoutesFromReactChildren = require('./createRoutesFromReactChildren'); + +exports.create = require('./createRouter'); +exports.run = require('./runRouter'); +},{"./History":5,"./Navigation":7,"./Route":11,"./State":13,"./behaviors/ImitateBrowserBehavior":16,"./behaviors/ScrollToTopBehavior":17,"./components/DefaultRoute":19,"./components/Link":20,"./components/NotFoundRoute":21,"./components/Redirect":22,"./components/Route":23,"./components/RouteHandler":24,"./createRouter":25,"./createRoutesFromReactChildren":26,"./locations/HashLocation":29,"./locations/HistoryLocation":30,"./locations/RefreshLocation":31,"./locations/StaticLocation":32,"./locations/TestLocation":33,"./runRouter":34}],"react/addons":[function(require,module,exports){ module.exports = require('./lib/ReactWithAddons'); },{"./lib/ReactWithAddons":141}],"react":[function(require,module,exports){ module.exports = require('./lib/React'); -},{"./lib/React":71}]},{},["flux","jquery","lodash","react","react-router","react/addons"]); +},{"./lib/React":71}]},{},[]) + + +//# sourceMappingURL=vendor.js.map |