aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/web/static/app.css3
-rw-r--r--mitmproxy/web/static/app.js100
-rw-r--r--mitmproxy/web/static/vendor.js926
-rw-r--r--web/src/css/header.less4
-rw-r--r--web/src/js/components/common.js14
-rw-r--r--web/src/js/components/header.js70
6 files changed, 692 insertions, 425 deletions
diff --git a/mitmproxy/web/static/app.css b/mitmproxy/web/static/app.css
index 90b177c2..824dd827 100644
--- a/mitmproxy/web/static/app.css
+++ b/mitmproxy/web/static/app.css
@@ -163,6 +163,9 @@ header .menu {
max-height: 500px;
overflow-y: auto;
}
+.menu .btn {
+ margin: 2px 2px 2px 2px;
+}
.flow-table {
width: 100%;
overflow-y: scroll;
diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js
index 2dadc696..1e8e313d 100644
--- a/mitmproxy/web/static/app.js
+++ b/mitmproxy/web/static/app.js
@@ -481,7 +481,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.Splitter = exports.Router = undefined;
+exports.ToggleComponent = exports.Splitter = exports.Router = undefined;
var _react = require("react");
@@ -631,6 +631,27 @@ var Splitter = exports.Splitter = _react2.default.createClass({
}
});
+var ToggleComponent = exports.ToggleComponent = function ToggleComponent(props) {
+ return _react2.default.createElement(
+ "div",
+ {
+ className: "btn " + (props.checked ? "btn-primary" : "btn-default"),
+ onClick: props.onToggleChanged },
+ _react2.default.createElement(
+ "span",
+ null,
+ _react2.default.createElement("i", { className: "fa " + (props.checked ? "fa-check-square-o" : "fa-square-o") }),
+ " ",
+ props.name
+ )
+ );
+};
+
+ToggleComponent.propTypes = {
+ name: _react2.default.PropTypes.string.isRequired,
+ onToggleChanged: _react2.default.PropTypes.func.isRequired
+};
+
},{"lodash":"lodash","react":"react","react-dom":"react-dom"}],5:[function(require,module,exports){
"use strict";
@@ -2912,6 +2933,8 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Header = exports.MainMenu = undefined;
+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 _react = require("react");
var _react2 = _interopRequireDefault(_react);
@@ -2936,6 +2959,12 @@ var _actions = require("../actions.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+function _inherits(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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
var FilterDocs = _react2.default.createClass({
displayName: "FilterDocs",
@@ -3191,7 +3220,6 @@ var ViewMenu = _react2.default.createClass({
mixins: [_common.Router],
toggleEventLog: function toggleEventLog() {
var d = {};
-
if (this.getQuery()[_actions.Query.SHOW_EVENTLOG]) {
d[_actions.Query.SHOW_EVENTLOG] = undefined;
} else {
@@ -3199,29 +3227,69 @@ var ViewMenu = _react2.default.createClass({
}
this.updateLocation(undefined, d);
+ console.log('toggleevent');
},
render: function render() {
var showEventLog = this.getQuery()[_actions.Query.SHOW_EVENTLOG];
return _react2.default.createElement(
"div",
null,
- _react2.default.createElement(
- "button",
- {
- className: "btn " + (showEventLog ? "btn-primary" : "btn-default"),
- onClick: this.toggleEventLog },
- _react2.default.createElement("i", { className: "fa fa-database" }),
- " Show Eventlog"
- ),
- _react2.default.createElement(
- "span",
- null,
- " "
- )
+ _react2.default.createElement(_common.ToggleComponent, {
+ checked: showEventLog,
+ name: "Show Eventlog",
+ onToggleChanged: this.toggleEventLog })
);
}
});
+var OptionMenu = function (_React$Component) {
+ _inherits(OptionMenu, _React$Component);
+
+ function OptionMenu(props) {
+ _classCallCheck(this, OptionMenu);
+
+ var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(OptionMenu).call(this, props));
+
+ _this.state = {
+ options: [{ name: "--host", checked: true }, { name: "--no-upstream-cert", checked: false }, { name: "--http2", checked: false }, { name: "--anticache", checked: false }, { name: "--anticomp", checked: false }, { name: "--stickycookie", checked: true }, { name: "--stickyauth", checked: false }, { name: "--stream", checked: false }]
+ };
+ return _this;
+ }
+
+ _createClass(OptionMenu, [{
+ key: "setOption",
+ value: function setOption(entry) {
+ console.log(entry.name); //TODO: get options from outside and remove state
+ entry.checked = !entry.checked;
+ this.setState({ options: this.state.options });
+ }
+ }, {
+ key: "render",
+ value: function render() {
+ var _this2 = this;
+
+ return _react2.default.createElement(
+ "div",
+ null,
+ this.state.options.map(function (entry, i) {
+ return _react2.default.createElement(_common.ToggleComponent, {
+ key: i,
+ checked: entry.checked,
+ name: entry.name,
+ onToggleChanged: function onToggleChanged() {
+ return _this2.setOption(entry);
+ } });
+ })
+ );
+ }
+ }]);
+
+ return OptionMenu;
+}(_react2.default.Component);
+
+OptionMenu.title = "Options";
+
+
var ReportsMenu = _react2.default.createClass({
displayName: "ReportsMenu",
@@ -3318,7 +3386,7 @@ var FileMenu = _react2.default.createClass({
}
});
-var header_entries = [MainMenu, ViewMenu /*, ReportsMenu */];
+var header_entries = [MainMenu, ViewMenu, OptionMenu /*, ReportsMenu */];
var Header = exports.Header = _react2.default.createClass({
displayName: "Header",
diff --git a/mitmproxy/web/static/vendor.js b/mitmproxy/web/static/vendor.js
index 548fc355..44bc86d8 100644
--- a/mitmproxy/web/static/vendor.js
+++ b/mitmproxy/web/static/vendor.js
@@ -2116,13 +2116,15 @@ var KNOWN_STATICS = {
};
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
- var keys = Object.getOwnPropertyNames(sourceComponent);
- for (var i=0; i<keys.length; ++i) {
- if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
- try {
- targetComponent[keys[i]] = sourceComponent[keys[i]];
- } catch (error) {
-
+ if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
+ var keys = Object.getOwnPropertyNames(sourceComponent);
+ for (var i=0; i<keys.length; ++i) {
+ if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
+ try {
+ targetComponent[keys[i]] = sourceComponent[keys[i]];
+ } catch (error) {
+
+ }
}
}
}
@@ -2991,8 +2993,8 @@ function keysIn(object) {
module.exports = keys;
},{"lodash._getnative":24,"lodash.isarguments":25,"lodash.isarray":26}],28:[function(require,module,exports){
-/* eslint-disable no-unused-vars */
'use strict';
+/* eslint-disable no-unused-vars */
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
@@ -3004,7 +3006,51 @@ function toObject(val) {
return Object(val);
}
-module.exports = Object.assign || function (target, source) {
+function shouldUseNative() {
+ try {
+ if (!Object.assign) {
+ return false;
+ }
+
+ // Detect buggy property enumeration order in older V8 versions.
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
+ var test1 = new String('abc'); // eslint-disable-line
+ test1[5] = 'de';
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
+ return false;
+ }
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
+ var test2 = {};
+ for (var i = 0; i < 10; i++) {
+ test2['_' + String.fromCharCode(i)] = i;
+ }
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
+ return test2[n];
+ });
+ if (order2.join('') !== '0123456789') {
+ return false;
+ }
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
+ var test3 = {};
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
+ test3[letter] = letter;
+ });
+ if (Object.keys(Object.assign({}, test3)).join('') !==
+ 'abcdefghijklmnopqrst') {
+ return false;
+ }
+
+ return true;
+ } catch (e) {
+ // We don't expect any of the above to throw, but better to be safe.
+ return false;
+ }
+}
+
+module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
@@ -3041,6 +3087,9 @@ var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
@@ -35673,8 +35722,7 @@ return jQuery;
(function (global){
/**
* @license
- * lodash 4.11.2 (Custom Build) <https://lodash.com/>
- * Build: `lodash -d -o ./foo/lodash.js`
+ * lodash <https://lodash.com/>
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@@ -35686,7 +35734,7 @@ return jQuery;
var undefined;
/** Used as the semantic version number. */
- var VERSION = '4.11.2';
+ var VERSION = '4.12.0';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
@@ -36131,30 +36179,6 @@ return jQuery;
}
/**
- * Creates a new array concatenating `array` with `other`.
- *
- * @private
- * @param {Array} array The first array to concatenate.
- * @param {Array} other The second array to concatenate.
- * @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;
- }
-
- /**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
@@ -36581,7 +36605,7 @@ return jQuery;
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
- * @returns {Object} Returns the new array of key-value pairs.
+ * @returns {Object} Returns the key-value pairs.
*/
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
@@ -36594,7 +36618,7 @@ return jQuery;
*
* @private
* @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
@@ -36619,6 +36643,18 @@ return jQuery;
}
/**
+ * Checks if a cache value for `key` exists.
+ *
+ * @private
+ * @param {Object} cache The cache to query.
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function cacheHas(cache, key) {
+ return cache.has(key);
+ }
+
+ /**
* Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
* that is not found in the character symbols.
*
@@ -36774,11 +36810,11 @@ return jQuery;
}
/**
- * Converts `map` to an array.
+ * Converts `map` to its key-value pairs.
*
* @private
* @param {Object} map The map to convert.
- * @returns {Array} Returns the converted array.
+ * @returns {Array} Returns the key-value pairs.
*/
function mapToArray(map) {
var index = -1,
@@ -36816,11 +36852,11 @@ return jQuery;
}
/**
- * Converts `set` to an array.
+ * Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
- * @returns {Array} Returns the converted array.
+ * @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
@@ -36833,6 +36869,23 @@ return jQuery;
}
/**
+ * Converts `set` to its value-value pairs.
+ *
+ * @private
+ * @param {Object} set The set to convert.
+ * @returns {Array} Returns the value-value pairs.
+ */
+ function setToPairs(set) {
+ var index = -1,
+ result = Array(set.size);
+
+ set.forEach(function(value) {
+ result[++index] = [value, value];
+ });
+ return result;
+ }
+
+ /**
* Gets the number of symbols in `string`.
*
* @private
@@ -37085,10 +37138,10 @@ return jQuery;
* `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
* `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,
* `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,
- * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,
- * `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
- * `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,
- * `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
+ * `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`,
+ * `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`,
+ * `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`,
+ * `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
@@ -37097,9 +37150,9 @@ return jQuery;
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
- * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,
- * `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,
- * `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
+ * `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toFinite`,
+ * `toInteger`, `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`,
+ * `toString`, `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
* `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`
*
* @name _
@@ -37359,64 +37412,212 @@ return jQuery;
*
* @private
* @constructor
- * @returns {Object} Returns the new hash object.
+ * @param {Array} [entries] The key-value pairs to cache.
*/
- function Hash() {}
+ function Hash(entries) {
+ var index = -1,
+ length = entries ? entries.length : 0;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the hash.
+ *
+ * @private
+ * @name clear
+ * @memberOf Hash
+ */
+ function hashClear() {
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
+ }
/**
* Removes `key` and its value from the hash.
*
* @private
+ * @name delete
+ * @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
- function hashDelete(hash, key) {
- return hashHas(hash, key) && delete hash[key];
+ function hashDelete(key) {
+ return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
- * @param {Object} hash The hash to query.
+ * @name get
+ * @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
- function hashGet(hash, key) {
+ function hashGet(key) {
+ var data = this.__data__;
if (nativeCreate) {
- var result = hash[key];
+ var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
- return hasOwnProperty.call(hash, key) ? hash[key] : undefined;
+ return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
- * @param {Object} hash The hash to query.
+ * @name has
+ * @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
- function hashHas(hash, key) {
- return nativeCreate ? hash[key] !== undefined : hasOwnProperty.call(hash, key);
+ function hashHas(key) {
+ var data = this.__data__;
+ return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
- * @param {Object} hash The hash to modify.
+ * @name set
+ * @memberOf Hash
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the hash instance.
+ */
+ function hashSet(key, value) {
+ var data = this.__data__;
+ data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
+ return this;
+ }
+
+ // Add methods to `Hash`.
+ Hash.prototype.clear = hashClear;
+ Hash.prototype['delete'] = hashDelete;
+ Hash.prototype.get = hashGet;
+ Hash.prototype.has = hashHas;
+ Hash.prototype.set = hashSet;
+
+ /*------------------------------------------------------------------------*/
+
+ /**
+ * Creates an list cache object.
+ *
+ * @private
+ * @constructor
+ * @param {Array} [entries] The key-value pairs to cache.
+ */
+ function ListCache(entries) {
+ var index = -1,
+ length = entries ? entries.length : 0;
+
+ this.clear();
+ while (++index < length) {
+ var entry = entries[index];
+ this.set(entry[0], entry[1]);
+ }
+ }
+
+ /**
+ * Removes all key-value entries from the list cache.
+ *
+ * @private
+ * @name clear
+ * @memberOf ListCache
+ */
+ function listCacheClear() {
+ this.__data__ = [];
+ }
+
+ /**
+ * Removes `key` and its value from the list cache.
+ *
+ * @private
+ * @name delete
+ * @memberOf ListCache
+ * @param {string} key The key of the value to remove.
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
+ */
+ function listCacheDelete(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ return false;
+ }
+ var lastIndex = data.length - 1;
+ if (index == lastIndex) {
+ data.pop();
+ } else {
+ splice.call(data, index, 1);
+ }
+ return true;
+ }
+
+ /**
+ * Gets the list cache value for `key`.
+ *
+ * @private
+ * @name get
+ * @memberOf ListCache
+ * @param {string} key The key of the value to get.
+ * @returns {*} Returns the entry value.
+ */
+ function listCacheGet(key) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ return index < 0 ? undefined : data[index][1];
+ }
+
+ /**
+ * Checks if a list cache value for `key` exists.
+ *
+ * @private
+ * @name has
+ * @memberOf ListCache
+ * @param {string} key The key of the entry to check.
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
+ */
+ function listCacheHas(key) {
+ return assocIndexOf(this.__data__, key) > -1;
+ }
+
+ /**
+ * Sets the list cache `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
+ * @returns {Object} Returns the list cache instance.
*/
- function hashSet(hash, key, value) {
- hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
+ function listCacheSet(key, value) {
+ var data = this.__data__,
+ index = assocIndexOf(data, key);
+
+ if (index < 0) {
+ data.push([key, value]);
+ } else {
+ data[index][1] = value;
+ }
+ return this;
}
- // Avoid inheriting from `Object.prototype` when possible.
- Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto;
+ // Add methods to `ListCache`.
+ ListCache.prototype.clear = listCacheClear;
+ ListCache.prototype['delete'] = listCacheDelete;
+ ListCache.prototype.get = listCacheGet;
+ ListCache.prototype.has = listCacheHas;
+ ListCache.prototype.set = listCacheSet;
/*------------------------------------------------------------------------*/
@@ -37425,15 +37626,15 @@ return jQuery;
*
* @private
* @constructor
- * @param {Array} [values] The values to cache.
+ * @param {Array} [entries] The key-value pairs to cache.
*/
- function MapCache(values) {
+ function MapCache(entries) {
var index = -1,
- length = values ? values.length : 0;
+ length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
- var entry = values[index];
+ var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
@@ -37445,10 +37646,10 @@ return jQuery;
* @name clear
* @memberOf MapCache
*/
- function mapClear() {
+ function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
- 'map': Map ? new Map : [],
+ 'map': new (Map || ListCache),
'string': new Hash
};
}
@@ -37462,12 +37663,8 @@ return jQuery;
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
- function mapDelete(key) {
- var data = this.__data__;
- if (isKeyable(key)) {
- return hashDelete(typeof key == 'string' ? data.string : data.hash, key);
- }
- return Map ? data.map['delete'](key) : assocDelete(data.map, key);
+ function mapCacheDelete(key) {
+ return getMapData(this, key)['delete'](key);
}
/**
@@ -37479,12 +37676,8 @@ return jQuery;
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
- function mapGet(key) {
- var data = this.__data__;
- if (isKeyable(key)) {
- return hashGet(typeof key == 'string' ? data.string : data.hash, key);
- }
- return Map ? data.map.get(key) : assocGet(data.map, key);
+ function mapCacheGet(key) {
+ return getMapData(this, key).get(key);
}
/**
@@ -37496,12 +37689,8 @@ return jQuery;
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
- function mapHas(key) {
- var data = this.__data__;
- if (isKeyable(key)) {
- return hashHas(typeof key == 'string' ? data.string : data.hash, key);
- }
- return Map ? data.map.has(key) : assocHas(data.map, key);
+ function mapCacheHas(key) {
+ return getMapData(this, key).has(key);
}
/**
@@ -37514,30 +37703,23 @@ return jQuery;
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
- function mapSet(key, value) {
- var data = this.__data__;
- if (isKeyable(key)) {
- hashSet(typeof key == 'string' ? data.string : data.hash, key, value);
- } else if (Map) {
- data.map.set(key, value);
- } else {
- assocSet(data.map, key, value);
- }
+ function mapCacheSet(key, value) {
+ getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
- MapCache.prototype.clear = mapClear;
- MapCache.prototype['delete'] = mapDelete;
- MapCache.prototype.get = mapGet;
- MapCache.prototype.has = mapHas;
- MapCache.prototype.set = mapSet;
+ MapCache.prototype.clear = mapCacheClear;
+ MapCache.prototype['delete'] = mapCacheDelete;
+ MapCache.prototype.get = mapCacheGet;
+ MapCache.prototype.has = mapCacheHas;
+ MapCache.prototype.set = mapCacheSet;
/*------------------------------------------------------------------------*/
/**
*
- * Creates a set cache object to store unique values.
+ * Creates an array cache object to store unique values.
*
* @private
* @constructor
@@ -37549,52 +37731,41 @@ return jQuery;
this.__data__ = new MapCache;
while (++index < length) {
- this.push(values[index]);
+ this.add(values[index]);
}
}
/**
- * Checks if `value` is in `cache`.
+ * Adds `value` to the array cache.
*
* @private
- * @param {Object} cache The set cache to search.
- * @param {*} value The value to search for.
- * @returns {number} Returns `true` if `value` is found, else `false`.
+ * @name add
+ * @memberOf SetCache
+ * @alias push
+ * @param {*} value The value to cache.
+ * @returns {Object} Returns the cache instance.
*/
- function cacheHas(cache, value) {
- var map = cache.__data__;
- if (isKeyable(value)) {
- var data = map.__data__,
- hash = typeof value == 'string' ? data.string : data.hash;
-
- return hash[value] === HASH_UNDEFINED;
- }
- return map.has(value);
+ function setCacheAdd(value) {
+ this.__data__.set(value, HASH_UNDEFINED);
+ return this;
}
/**
- * Adds `value` to the set cache.
+ * Checks if `value` is in the array cache.
*
* @private
- * @name push
+ * @name has
* @memberOf SetCache
- * @param {*} value The value to cache.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `true` if `value` is found, else `false`.
*/
- function cachePush(value) {
- var map = this.__data__;
- if (isKeyable(value)) {
- var data = map.__data__,
- hash = typeof value == 'string' ? data.string : data.hash;
-
- hash[value] = HASH_UNDEFINED;
- }
- else {
- map.set(value, HASH_UNDEFINED);
- }
+ function setCacheHas(value) {
+ return this.__data__.has(value);
}
// Add methods to `SetCache`.
- SetCache.prototype.push = cachePush;
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
+ SetCache.prototype.has = setCacheHas;
/*------------------------------------------------------------------------*/
@@ -37603,17 +37774,10 @@ return jQuery;
*
* @private
* @constructor
- * @param {Array} [values] The values to cache.
+ * @param {Array} [entries] The key-value pairs to cache.
*/
- function Stack(values) {
- var index = -1,
- length = values ? values.length : 0;
-
- this.clear();
- while (++index < length) {
- var entry = values[index];
- this.set(entry[0], entry[1]);
- }
+ function Stack(entries) {
+ this.__data__ = new ListCache(entries);
}
/**
@@ -37624,7 +37788,7 @@ return jQuery;
* @memberOf Stack
*/
function stackClear() {
- this.__data__ = { 'array': [], 'map': null };
+ this.__data__ = new ListCache;
}
/**
@@ -37637,10 +37801,7 @@ return jQuery;
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocDelete(array, key) : data.map['delete'](key);
+ return this.__data__['delete'](key);
}
/**
@@ -37653,10 +37814,7 @@ return jQuery;
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocGet(array, key) : data.map.get(key);
+ return this.__data__.get(key);
}
/**
@@ -37669,10 +37827,7 @@ return jQuery;
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
- var data = this.__data__,
- array = data.array;
-
- return array ? assocHas(array, key) : data.map.has(key);
+ return this.__data__.has(key);
}
/**
@@ -37686,21 +37841,11 @@ return jQuery;
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
- var data = this.__data__,
- array = data.array;
-
- if (array) {
- if (array.length < (LARGE_ARRAY_SIZE - 1)) {
- assocSet(array, key, value);
- } else {
- data.array = null;
- data.map = new MapCache(array);
- }
- }
- var map = data.map;
- if (map) {
- map.set(key, value);
+ var cache = this.__data__;
+ if (cache instanceof ListCache && cache.__data__.length == LARGE_ARRAY_SIZE) {
+ cache = this.__data__ = new MapCache(cache.__data__);
}
+ cache.set(key, value);
return this;
}
@@ -37714,90 +37859,6 @@ return jQuery;
/*------------------------------------------------------------------------*/
/**
- * Removes `key` and its value from the associative array.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {string} key The key of the value to remove.
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
- */
- function assocDelete(array, key) {
- var index = assocIndexOf(array, key);
- if (index < 0) {
- return false;
- }
- var lastIndex = array.length - 1;
- if (index == lastIndex) {
- array.pop();
- } else {
- splice.call(array, index, 1);
- }
- return true;
- }
-
- /**
- * Gets the associative array value for `key`.
- *
- * @private
- * @param {Array} array The array to query.
- * @param {string} key The key of the value to get.
- * @returns {*} Returns the entry value.
- */
- function assocGet(array, key) {
- var index = assocIndexOf(array, key);
- return index < 0 ? undefined : array[index][1];
- }
-
- /**
- * Checks if an associative array value for `key` exists.
- *
- * @private
- * @param {Array} array The array to query.
- * @param {string} key The key of the entry to check.
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
- */
- function assocHas(array, key) {
- return assocIndexOf(array, key) > -1;
- }
-
- /**
- * Gets the index at which the `key` is found in `array` of key-value pairs.
- *
- * @private
- * @param {Array} array The array to search.
- * @param {*} key The key to search for.
- * @returns {number} Returns the index of the matched value, else `-1`.
- */
- function assocIndexOf(array, key) {
- var length = array.length;
- while (length--) {
- if (eq(array[length][0], key)) {
- return length;
- }
- }
- return -1;
- }
-
- /**
- * Sets the associative array `key` to `value`.
- *
- * @private
- * @param {Array} array The array to modify.
- * @param {string} key The key of the value to set.
- * @param {*} value The value to set.
- */
- function assocSet(array, key, value) {
- var index = assocIndexOf(array, key);
- if (index < 0) {
- array.push([key, value]);
- } else {
- array[index][1] = value;
- }
- }
-
- /*------------------------------------------------------------------------*/
-
- /**
* Used by `_.defaults` to customize its `_.assignIn` use.
*
* @private
@@ -37850,6 +37911,24 @@ return jQuery;
}
/**
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {*} key The key to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ */
+ function assocIndexOf(array, key) {
+ var length = array.length;
+ while (length--) {
+ if (eq(array[length][0], key)) {
+ return length;
+ }
+ }
+ return -1;
+ }
+
+ /**
* Aggregates elements of `collection` on `accumulator` with keys transformed
* by `iteratee` and values set by `setter`.
*
@@ -37886,7 +37965,7 @@ return jQuery;
* @private
* @param {Object} object The object to iterate over.
* @param {string[]} paths The property paths of elements to pick.
- * @returns {Array} Returns the new array of picked elements.
+ * @returns {Array} Returns the picked elements.
*/
function baseAt(object, paths) {
var index = -1,
@@ -38001,7 +38080,7 @@ return jQuery;
*
* @private
* @param {Object} source The object of property predicates to conform to.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
*/
function baseConforms(source) {
var props = keys(source),
@@ -38314,7 +38393,7 @@ return jQuery;
* @private
* @param {Object} object The object to inspect.
* @param {Array} props The property names to filter.
- * @returns {Array} Returns the new array of filtered property names.
+ * @returns {Array} Returns the function names.
*/
function baseFunctions(object, props) {
return arrayFilter(props, function(key) {
@@ -38355,9 +38434,7 @@ return jQuery;
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
- return isArray(object)
- ? result
- : arrayPush(result, symbolsFunc(object));
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
/**
@@ -38749,7 +38826,7 @@ return jQuery;
*
* @private
* @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
*/
function baseMatches(source) {
var matchData = getMatchData(source);
@@ -38767,7 +38844,7 @@ return jQuery;
* @private
* @param {string} path The path of the property to get.
* @param {*} srcValue The value to match.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
*/
function baseMatchesProperty(path, srcValue) {
if (isKey(path) && isStrictComparable(srcValue)) {
@@ -38982,7 +39059,7 @@ return jQuery;
*
* @private
* @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new accessor function.
*/
function baseProperty(key) {
return function(object) {
@@ -38995,7 +39072,7 @@ return jQuery;
*
* @private
* @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new accessor function.
*/
function basePropertyDeep(path) {
return function(object) {
@@ -39096,7 +39173,7 @@ return jQuery;
* @param {number} end The end of the range.
* @param {number} step The value to increment or decrement by.
* @param {boolean} [fromRight] Specify iterating from right to left.
- * @returns {Array} Returns the new array of numbers.
+ * @returns {Array} Returns the range of numbers.
*/
function baseRange(start, end, step, fromRight) {
var index = -1,
@@ -39810,7 +39887,7 @@ return jQuery;
* placeholders, and provided arguments into a single array of arguments.
*
* @private
- * @param {Array|Object} args The provided arguments.
+ * @param {Array} args The provided arguments.
* @param {Array} partials The arguments to prepend to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
@@ -39845,7 +39922,7 @@ return jQuery;
* is tailored for `_.partialRight`.
*
* @private
- * @param {Array|Object} args The provided arguments.
+ * @param {Array} args The provided arguments.
* @param {Array} partials The arguments to append to those provided.
* @param {Array} holders The `partials` placeholder indexes.
* @params {boolean} [isCurried] Specify composing for a curried function.
@@ -39967,7 +40044,7 @@ return jQuery;
customizer = length > 1 ? sources[length - 1] : undefined,
guard = length > 2 ? sources[2] : undefined;
- customizer = typeof customizer == 'function'
+ customizer = (assigner.length > 3 && typeof customizer == 'function')
? (length--, customizer)
: undefined;
@@ -40066,7 +40143,7 @@ return jQuery;
*
* @private
* @param {string} methodName The name of the `String` case method to use.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new case function.
*/
function createCaseFirst(methodName) {
return function(string) {
@@ -40151,7 +40228,7 @@ return jQuery;
var length = arguments.length,
args = Array(length),
index = length,
- placeholder = getPlaceholder(wrapper);
+ placeholder = getHolder(wrapper);
while (index--) {
args[index] = arguments[index];
@@ -40266,14 +40343,14 @@ return jQuery;
function wrapper() {
var length = arguments.length,
- index = length,
- args = Array(length);
+ args = Array(length),
+ index = length;
while (index--) {
args[index] = arguments[index];
}
if (isCurried) {
- var placeholder = getPlaceholder(wrapper),
+ var placeholder = getHolder(wrapper),
holdersCount = countHolders(args, placeholder);
}
if (partials) {
@@ -40362,7 +40439,7 @@ return jQuery;
*
* @private
* @param {Function} arrayFunc The function to iterate over iteratees.
- * @returns {Function} Returns the new invoker function.
+ * @returns {Function} Returns the new over function.
*/
function createOver(arrayFunc) {
return rest(function(iteratees) {
@@ -40561,6 +40638,26 @@ return jQuery;
};
/**
+ * Creates a `_.toPairs` or `_.toPairsIn` function.
+ *
+ * @private
+ * @param {Function} keysFunc The function to get the keys of a given object.
+ * @returns {Function} Returns the new pairs function.
+ */
+ function createToPairs(keysFunc) {
+ return function(object) {
+ var tag = getTag(object);
+ if (tag == mapTag) {
+ return mapToArray(object);
+ }
+ if (tag == setTag) {
+ return setToPairs(object);
+ }
+ return baseToPairs(object, keysFunc(object));
+ };
+ }
+
+ /**
* Creates a function that either curries or invokes `func` with optional
* `this` binding and partially applied arguments.
*
@@ -40577,6 +40674,7 @@ return jQuery;
* 64 - `_.partialRight`
* 128 - `_.rearg`
* 256 - `_.ary`
+ * 512 - `_.flip`
* @param {*} [thisArg] The `this` binding of `func`.
* @param {Array} [partials] The arguments to be partially applied.
* @param {Array} [holders] The `partials` placeholder indexes.
@@ -40655,9 +40753,7 @@ return jQuery;
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
- var index = -1,
- isPartial = bitmask & PARTIAL_COMPARE_FLAG,
- isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
+ var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
arrLength = array.length,
othLength = other.length;
@@ -40669,7 +40765,10 @@ return jQuery;
if (stacked) {
return stacked == other;
}
- var result = true;
+ var index = -1,
+ result = true,
+ seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
+
stack.set(array, other);
// Ignore non-index properties.
@@ -40690,10 +40789,12 @@ return jQuery;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
- if (isUnordered) {
- if (!arraySome(other, function(othValue) {
- return arrValue === othValue ||
- equalFunc(arrValue, othValue, customizer, bitmask, stack);
+ if (seen) {
+ if (!arraySome(other, function(othValue, othIndex) {
+ if (!seen.has(othIndex) &&
+ (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
+ return seen.add(othIndex);
+ }
})) {
result = false;
break;
@@ -40928,6 +41029,18 @@ return jQuery;
}
/**
+ * Gets the argument placeholder value for `func`.
+ *
+ * @private
+ * @param {Function} func The function to inspect.
+ * @returns {*} Returns the placeholder value.
+ */
+ function getHolder(func) {
+ var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
+ return object.placeholder;
+ }
+
+ /**
* Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
* this function returns the custom method, otherwise it returns `baseIteratee`.
* If arguments are provided, the chosen function is invoked with them and
@@ -40958,6 +41071,21 @@ return jQuery;
var getLength = baseProperty('length');
/**
+ * Gets the data for `map`.
+ *
+ * @private
+ * @param {Object} map The map to query.
+ * @param {string} key The reference key.
+ * @returns {*} Returns the map data.
+ */
+ function getMapData(map, key) {
+ var data = map.__data__;
+ return isKeyable(key)
+ ? data[typeof key == 'string' ? 'string' : 'hash']
+ : data.map;
+ }
+
+ /**
* Gets the property names, values, and compare flags of `object`.
*
* @private
@@ -40988,18 +41116,6 @@ return jQuery;
}
/**
- * Gets the argument placeholder value for `func`.
- *
- * @private
- * @param {Function} func The function to inspect.
- * @returns {*} Returns the placeholder value.
- */
- function getPlaceholder(func) {
- var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
- return object.placeholder;
- }
-
- /**
* Gets the `[[Prototype]]` of `value`.
*
* @private
@@ -41248,7 +41364,7 @@ return jQuery;
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
*/
function isFlattenable(value) {
- return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
+ return isArray(value) || isArguments(value);
}
/**
@@ -41392,7 +41508,7 @@ return jQuery;
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
@@ -41644,7 +41760,7 @@ return jQuery;
* @param {Array} array The array to process.
* @param {number} [size=1] The length of each chunk
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Array} Returns the new array containing chunks.
+ * @returns {Array} Returns the new array of chunks.
* @example
*
* _.chunk(['a', 'b', 'c', 'd'], 2);
@@ -41727,16 +41843,16 @@ return jQuery;
*/
function concat() {
var length = arguments.length,
- array = castArray(arguments[0]);
+ args = Array(length ? length - 1 : 0),
+ array = arguments[0],
+ index = length;
- if (length < 2) {
- return length ? copyArray(array) : [];
- }
- var args = Array(length - 1);
- while (length--) {
- args[length - 1] = arguments[length];
+ while (index--) {
+ args[index - 1] = arguments[index];
}
- return arrayConcat(array, baseFlatten(args, 1));
+ return length
+ ? arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1))
+ : [];
}
/**
@@ -42455,8 +42571,8 @@ return jQuery;
}
/**
- * Gets the nth element of `array`. If `n` is negative, the nth element
- * from the end is returned.
+ * Gets the element at `n` index of `array`. If `n` is negative, the nth
+ * element from the end is returned.
*
* @static
* @memberOf _
@@ -43336,7 +43452,7 @@ return jQuery;
* @memberOf _
* @since 0.1.0
* @category Array
- * @param {Array} array The array to filter.
+ * @param {Array} array The array to inspect.
* @param {...*} [values] The values to exclude.
* @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.xor
@@ -43362,7 +43478,7 @@ return jQuery;
* @since 2.4.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
- * @returns {Array} Returns the new array of values.
+ * @returns {Array} Returns the new array of filtered values.
* @see _.difference, _.without
* @example
*
@@ -43386,7 +43502,7 @@ return jQuery;
* @param {...Array} [arrays] The arrays to inspect.
* @param {Array|Function|Object|string} [iteratee=_.identity]
* The iteratee invoked per element.
- * @returns {Array} Returns the new array of values.
+ * @returns {Array} Returns the new array of filtered values.
* @example
*
* _.xorBy([2.1, 1.2], [4.3, 2.4], Math.floor);
@@ -43415,7 +43531,7 @@ return jQuery;
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @param {Function} [comparator] The comparator invoked per element.
- * @returns {Array} Returns the new array of values.
+ * @returns {Array} Returns the new array of filtered values.
* @example
*
* var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
@@ -44163,9 +44279,8 @@ return jQuery;
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forEach(collection, iteratee) {
- return (typeof iteratee == 'function' && isArray(collection))
- ? arrayEach(collection, iteratee)
- : baseEach(collection, getIteratee(iteratee));
+ var func = isArray(collection) ? arrayEach : baseEach;
+ return func(collection, getIteratee(iteratee, 3));
}
/**
@@ -44189,9 +44304,8 @@ return jQuery;
* // => Logs `2` then `1`.
*/
function forEachRight(collection, iteratee) {
- return (typeof iteratee == 'function' && isArray(collection))
- ? arrayEachRight(collection, iteratee)
- : baseEachRight(collection, getIteratee(iteratee));
+ var func = isArray(collection) ? arrayEachRight : baseEachRight;
+ return func(collection, getIteratee(iteratee, 3));
}
/**
@@ -44872,7 +44986,7 @@ return jQuery;
* @param {Function} func The function to cap arguments for.
* @param {number} [n=func.length] The arity cap.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new capped function.
* @example
*
* _.map(['6', '8', '10'], _.ary(parseInt, 1));
@@ -44956,7 +45070,7 @@ return jQuery;
var bind = rest(function(func, thisArg, partials) {
var bitmask = BIND_FLAG;
if (partials.length) {
- var holders = replaceHolders(partials, getPlaceholder(bind));
+ var holders = replaceHolders(partials, getHolder(bind));
bitmask |= PARTIAL_FLAG;
}
return createWrapper(func, bitmask, thisArg, partials, holders);
@@ -45010,7 +45124,7 @@ return jQuery;
var bindKey = rest(function(object, key, partials) {
var bitmask = BIND_FLAG | BIND_KEY_FLAG;
if (partials.length) {
- var holders = replaceHolders(partials, getPlaceholder(bindKey));
+ var holders = replaceHolders(partials, getHolder(bindKey));
bitmask |= PARTIAL_FLAG;
}
return createWrapper(key, bitmask, object, partials, holders);
@@ -45336,7 +45450,7 @@ return jQuery;
* @since 4.0.0
* @category Function
* @param {Function} func The function to flip arguments for.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new flipped function.
* @example
*
* var flipped = _.flip(function() {
@@ -45369,7 +45483,7 @@ return jQuery;
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
- * @returns {Function} Returns the new memoizing function.
+ * @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
@@ -45427,7 +45541,7 @@ return jQuery;
* @since 3.0.0
* @category Function
* @param {Function} predicate The predicate to negate.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new negated function.
* @example
*
* function isEven(n) {
@@ -45551,7 +45665,7 @@ return jQuery;
* // => 'hi fred'
*/
var partial = rest(function(func, partials) {
- var holders = replaceHolders(partials, getPlaceholder(partial));
+ var holders = replaceHolders(partials, getHolder(partial));
return createWrapper(func, PARTIAL_FLAG, undefined, partials, holders);
});
@@ -45588,7 +45702,7 @@ return jQuery;
* // => 'hello fred'
*/
var partialRight = rest(function(func, partials) {
- var holders = replaceHolders(partials, getPlaceholder(partialRight));
+ var holders = replaceHolders(partials, getHolder(partialRight));
return createWrapper(func, PARTIAL_RIGHT_FLAG, undefined, partials, holders);
});
@@ -45790,7 +45904,7 @@ return jQuery;
* @since 4.0.0
* @category Function
* @param {Function} func The function to cap arguments for.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new capped function.
* @example
*
* _.map(['6', '8', '10'], _.unary(parseInt));
@@ -46466,14 +46580,14 @@ return jQuery;
* _.isFinite(3);
* // => true
*
- * _.isFinite(Number.MAX_VALUE);
- * // => true
- *
- * _.isFinite(3.14);
+ * _.isFinite(Number.MIN_VALUE);
* // => true
*
* _.isFinite(Infinity);
* // => false
+ *
+ * _.isFinite('3');
+ * // => false
*/
function isFinite(value) {
return typeof value == 'number' && nativeIsFinite(value);
@@ -47195,6 +47309,41 @@ return jQuery;
}
/**
+ * Converts `value` to a finite number.
+ *
+ * @static
+ * @memberOf _
+ * @since 4.12.0
+ * @category Lang
+ * @param {*} value The value to convert.
+ * @returns {number} Returns the converted number.
+ * @example
+ *
+ * _.toFinite(3.2);
+ * // => 3.2
+ *
+ * _.toFinite(Number.MIN_VALUE);
+ * // => 5e-324
+ *
+ * _.toFinite(Infinity);
+ * // => 1.7976931348623157e+308
+ *
+ * _.toFinite('3.2');
+ * // => 3.2
+ */
+ function toFinite(value) {
+ if (!value) {
+ return value === 0 ? value : 0;
+ }
+ value = toNumber(value);
+ if (value === INFINITY || value === -INFINITY) {
+ var sign = (value < 0 ? -1 : 1);
+ return sign * MAX_INTEGER;
+ }
+ return value === value ? value : 0;
+ }
+
+ /**
* Converts `value` to an integer.
*
* **Note:** This function is loosely based on
@@ -47208,7 +47357,7 @@ return jQuery;
* @returns {number} Returns the converted integer.
* @example
*
- * _.toInteger(3);
+ * _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
@@ -47217,20 +47366,14 @@ return jQuery;
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
- * _.toInteger('3');
+ * _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
- if (!value) {
- return value === 0 ? value : 0;
- }
- value = toNumber(value);
- if (value === INFINITY || value === -INFINITY) {
- var sign = (value < 0 ? -1 : 1);
- return sign * MAX_INTEGER;
- }
- var remainder = value % 1;
- return value === value ? (remainder ? value - remainder : value) : 0;
+ var result = toFinite(value),
+ remainder = result % 1;
+
+ return result === result ? (remainder ? result - remainder : result) : 0;
}
/**
@@ -47248,7 +47391,7 @@ return jQuery;
* @returns {number} Returns the converted integer.
* @example
*
- * _.toLength(3);
+ * _.toLength(3.2);
* // => 3
*
* _.toLength(Number.MIN_VALUE);
@@ -47257,7 +47400,7 @@ return jQuery;
* _.toLength(Infinity);
* // => 4294967295
*
- * _.toLength('3');
+ * _.toLength('3.2');
* // => 3
*/
function toLength(value) {
@@ -47275,8 +47418,8 @@ return jQuery;
* @returns {number} Returns the number.
* @example
*
- * _.toNumber(3);
- * // => 3
+ * _.toNumber(3.2);
+ * // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
@@ -47284,8 +47427,8 @@ return jQuery;
* _.toNumber(Infinity);
* // => Infinity
*
- * _.toNumber('3');
- * // => 3
+ * _.toNumber('3.2');
+ * // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
@@ -47348,7 +47491,7 @@ return jQuery;
* @returns {number} Returns the converted integer.
* @example
*
- * _.toSafeInteger(3);
+ * _.toSafeInteger(3.2);
* // => 3
*
* _.toSafeInteger(Number.MIN_VALUE);
@@ -47357,7 +47500,7 @@ return jQuery;
* _.toSafeInteger(Infinity);
* // => 9007199254740991
*
- * _.toSafeInteger('3');
+ * _.toSafeInteger('3.2');
* // => 3
*/
function toSafeInteger(value) {
@@ -47550,7 +47693,7 @@ return jQuery;
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths of elements to pick.
- * @returns {Array} Returns the new array of picked elements.
+ * @returns {Array} Returns the picked values.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
@@ -47766,7 +47909,7 @@ return jQuery;
function forIn(object, iteratee) {
return object == null
? object
- : baseFor(object, getIteratee(iteratee), keysIn);
+ : baseFor(object, getIteratee(iteratee, 3), keysIn);
}
/**
@@ -47798,7 +47941,7 @@ return jQuery;
function forInRight(object, iteratee) {
return object == null
? object
- : baseForRight(object, getIteratee(iteratee), keysIn);
+ : baseForRight(object, getIteratee(iteratee, 3), keysIn);
}
/**
@@ -47830,7 +47973,7 @@ return jQuery;
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
*/
function forOwn(object, iteratee) {
- return object && baseForOwn(object, getIteratee(iteratee));
+ return object && baseForOwn(object, getIteratee(iteratee, 3));
}
/**
@@ -47860,7 +48003,7 @@ return jQuery;
* // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
*/
function forOwnRight(object, iteratee) {
- return object && baseForOwnRight(object, getIteratee(iteratee));
+ return object && baseForOwnRight(object, getIteratee(iteratee, 3));
}
/**
@@ -47872,7 +48015,7 @@ return jQuery;
* @memberOf _
* @category Object
* @param {Object} object The object to inspect.
- * @returns {Array} Returns the new array of property names.
+ * @returns {Array} Returns the function names.
* @see _.functionsIn
* @example
*
@@ -47899,7 +48042,7 @@ return jQuery;
* @since 4.0.0
* @category Object
* @param {Object} object The object to inspect.
- * @returns {Array} Returns the new array of property names.
+ * @returns {Array} Returns the function names.
* @see _.functions
* @example
*
@@ -48252,7 +48395,7 @@ return jQuery;
* inherited enumerable string keyed properties of source objects into the
* destination object. Source properties that resolve to `undefined` are
* skipped if a destination value exists. Array and plain object properties
- * are merged recursively.Other objects and value types are overridden by
+ * are merged recursively. Other objects and value types are overridden by
* assignment. Source objects are applied from left to right. Subsequent
* sources overwrite property assignments of previous sources.
*
@@ -48537,7 +48680,8 @@ return jQuery;
/**
* Creates an array of own enumerable string keyed-value pairs for `object`
- * which can be consumed by `_.fromPairs`.
+ * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
+ * entries are returned.
*
* @static
* @memberOf _
@@ -48545,7 +48689,7 @@ return jQuery;
* @alias entries
* @category Object
* @param {Object} object The object to query.
- * @returns {Array} Returns the new array of key-value pairs.
+ * @returns {Array} Returns the key-value pairs.
* @example
*
* function Foo() {
@@ -48558,13 +48702,12 @@ return jQuery;
* _.toPairs(new Foo);
* // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
*/
- function toPairs(object) {
- return baseToPairs(object, keys(object));
- }
+ var toPairs = createToPairs(keys);
/**
* Creates an array of own and inherited enumerable string keyed-value pairs
- * for `object` which can be consumed by `_.fromPairs`.
+ * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
+ * or set, its entries are returned.
*
* @static
* @memberOf _
@@ -48572,7 +48715,7 @@ return jQuery;
* @alias entriesIn
* @category Object
* @param {Object} object The object to query.
- * @returns {Array} Returns the new array of key-value pairs.
+ * @returns {Array} Returns the key-value pairs.
* @example
*
* function Foo() {
@@ -48583,11 +48726,9 @@ return jQuery;
* Foo.prototype.c = 3;
*
* _.toPairsIn(new Foo);
- * // => [['a', 1], ['b', 2], ['c', 1]] (iteration order is not guaranteed)
+ * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
*/
- function toPairsIn(object) {
- return baseToPairs(object, keysIn(object));
- }
+ var toPairsIn = createToPairs(keysIn);
/**
* An alternative to `_.reduce`; this method transforms `object` to a new
@@ -49417,7 +49558,7 @@ return jQuery;
* @param {string} [string=''] The string to split.
* @param {RegExp|string} separator The separator pattern to split by.
* @param {number} [limit] The length to truncate results to.
- * @returns {Array} Returns the new array of string segments.
+ * @returns {Array} Returns the string segments.
* @example
*
* _.split('a-b-c', '-', 2);
@@ -49562,12 +49703,6 @@ return jQuery;
* compiled({ 'user': 'pebbles' });
* // => 'hello pebbles!'
*
- * // Use custom template delimiters.
- * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
- * var compiled = _.template('hello {{ user }}!');
- * compiled({ 'user': 'mustache' });
- * // => 'hello mustache!'
- *
* // Use backslashes to treat delimiters as plain text.
* var compiled = _.template('<%= "\\<%- value %\\>" %>');
* compiled({ 'value': 'ignored' });
@@ -49593,9 +49728,15 @@ return jQuery;
* // return __p;
* // }
*
+ * // Use custom template delimiters.
+ * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
+ * var compiled = _.template('hello {{ user }}!');
+ * compiled({ 'user': 'mustache' });
+ * // => 'hello mustache!'
+ *
* // Use the `source` property to inline compiled templates for meaningful
* // line numbers in error messages and stack traces.
- * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+ * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
* var JST = {\
* "main": ' + _.template(mainText).source + '\
* };\
@@ -50131,7 +50272,7 @@ return jQuery;
* @since 4.0.0
* @category Util
* @param {Array} pairs The predicate-function pairs.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new composite function.
* @example
*
* var func = _.cond([
@@ -50181,7 +50322,7 @@ return jQuery;
* @since 4.0.0
* @category Util
* @param {Object} source The object of property predicates to conform to.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
* @example
*
* var users = [
@@ -50204,7 +50345,7 @@ return jQuery;
* @since 2.4.0
* @category Util
* @param {*} value The value to return from the new function.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new constant function.
* @example
*
* var object = { 'user': 'fred' };
@@ -50229,7 +50370,7 @@ return jQuery;
* @since 3.0.0
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new composite function.
* @see _.flowRight
* @example
*
@@ -50252,7 +50393,7 @@ return jQuery;
* @memberOf _
* @category Util
* @param {...(Function|Function[])} [funcs] Functions to invoke.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new composite function.
* @see _.flow
* @example
*
@@ -50345,7 +50486,7 @@ return jQuery;
* @since 3.0.0
* @category Util
* @param {Object} source The object of property values to match.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
* @example
*
* var users = [
@@ -50373,7 +50514,7 @@ return jQuery;
* @category Util
* @param {Array|string} path The path of the property to get.
* @param {*} srcValue The value to match.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new spec function.
* @example
*
* var users = [
@@ -50398,7 +50539,7 @@ return jQuery;
* @category Util
* @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.
+ * @returns {Function} Returns the new invoker function.
* @example
*
* var objects = [
@@ -50429,7 +50570,7 @@ return jQuery;
* @category Util
* @param {Object} object The object to query.
* @param {...*} [args] The arguments to invoke the method with.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new invoker function.
* @example
*
* var array = _.times(3, _.constant),
@@ -50559,7 +50700,7 @@ return jQuery;
}
/**
- * Creates a function that returns its nth argument. If `n` is negative,
+ * Creates a function that gets the argument at `n` index. If `n` is negative,
* the nth argument from the end is returned.
*
* @static
@@ -50567,7 +50708,7 @@ return jQuery;
* @since 4.0.0
* @category Util
* @param {number} [n=0] The index of the argument to return.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new pass-thru function.
* @example
*
* var func = _.nthArg(1);
@@ -50665,7 +50806,7 @@ return jQuery;
* @since 2.4.0
* @category Util
* @param {Array|string} path The path of the property to get.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new accessor function.
* @example
*
* var objects = [
@@ -50692,7 +50833,7 @@ return jQuery;
* @since 3.0.0
* @category Util
* @param {Object} object The object to query.
- * @returns {Function} Returns the new function.
+ * @returns {Function} Returns the new accessor function.
* @example
*
* var array = [0, 1, 2],
@@ -50726,7 +50867,7 @@ return jQuery;
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
- * @returns {Array} Returns the new array of numbers.
+ * @returns {Array} Returns the range of numbers.
* @see _.inRange, _.rangeRight
* @example
*
@@ -50764,7 +50905,7 @@ return jQuery;
* @param {number} [start=0] The start of the range.
* @param {number} end The end of the range.
* @param {number} [step=1] The value to increment or decrement by.
- * @returns {Array} Returns the new array of numbers.
+ * @returns {Array} Returns the range of numbers.
* @see _.inRange, _.range
* @example
*
@@ -51525,6 +51666,7 @@ return jQuery;
lodash.sumBy = sumBy;
lodash.template = template;
lodash.times = times;
+ lodash.toFinite = toFinite;
lodash.toInteger = toInteger;
lodash.toLength = toLength;
lodash.toLower = toLower;
diff --git a/web/src/css/header.less b/web/src/css/header.less
index 8fa5e37f..065471d1 100644
--- a/web/src/css/header.less
+++ b/web/src/css/header.less
@@ -30,4 +30,8 @@ header {
max-height: 500px;
overflow-y: auto;
}
+}
+
+.menu .btn {
+ margin: 2px 2px 2px 2px;
} \ No newline at end of file
diff --git a/web/src/js/components/common.js b/web/src/js/components/common.js
index ad97ab38..21ca454f 100644
--- a/web/src/js/components/common.js
+++ b/web/src/js/components/common.js
@@ -131,4 +131,16 @@ export var Splitter = React.createClass({
</div>
);
}
-}); \ No newline at end of file
+});
+
+export const ToggleComponent = (props) =>
+ <div
+ className={"btn " + (props.checked ? "btn-primary" : "btn-default")}
+ onClick={props.onToggleChanged}>
+ <span><i className={"fa " + (props.checked ? "fa-check-square-o" : "fa-square-o")}></i> {props.name}</span>
+ </div>
+
+ToggleComponent.propTypes = {
+ name: React.PropTypes.string.isRequired,
+ onToggleChanged: React.PropTypes.func.isRequired
+} \ No newline at end of file
diff --git a/web/src/js/components/header.js b/web/src/js/components/header.js
index b4110851..226cb61f 100644
--- a/web/src/js/components/header.js
+++ b/web/src/js/components/header.js
@@ -4,7 +4,7 @@ import $ from "jquery";
import Filt from "../filt/filt.js";
import {Key} from "../utils.js";
-import {Router} from "./common.js";
+import {Router, ToggleComponent} from "./common.js";
import {SettingsActions, FlowActions} from "../actions.js";
import {Query} from "../actions.js";
@@ -227,7 +227,6 @@ var ViewMenu = React.createClass({
mixins: [Router],
toggleEventLog: function () {
var d = {};
-
if (this.getQuery()[Query.SHOW_EVENTLOG]) {
d[Query.SHOW_EVENTLOG] = undefined;
} else {
@@ -235,24 +234,63 @@ var ViewMenu = React.createClass({
}
this.updateLocation(undefined, d);
+ console.log('toggleevent');
},
render: function () {
- var showEventLog = this.getQuery()[Query.SHOW_EVENTLOG];
- return (
- <div>
- <button
- className={"btn " + (showEventLog ? "btn-primary" : "btn-default")}
- onClick={this.toggleEventLog}>
- <i className="fa fa-database"></i>
- &nbsp;Show Eventlog
- </button>
- <span> </span>
- </div>
- );
+ var showEventLog = this.getQuery()[Query.SHOW_EVENTLOG];
+ return (
+ <div>
+ <ToggleComponent
+ checked={showEventLog}
+ name = "Show Eventlog"
+ onToggleChanged={this.toggleEventLog}/>
+ </div>
+ );
}
});
+class OptionMenu extends React.Component{
+ static title = "Options";
+ constructor(props){
+ super(props);
+ this.state = {
+ options :
+ [
+ {name: "--host", checked: true},
+ {name: "--no-upstream-cert", checked: false},
+ {name: "--http2", checked: false},
+ {name: "--anticache", checked: false},
+ {name: "--anticomp", checked: false},
+ {name: "--stickycookie", checked: true},
+ {name: "--stickyauth", checked: false},
+ {name: "--stream", checked: false}
+ ]
+ }
+ }
+ setOption(entry){
+ console.log(entry.name);//TODO: get options from outside and remove state
+ entry.checked = !entry.checked;
+ this.setState({options: this.state.options});
+ }
+ render() {
+ return (
+ <div>
+ {this.state.options.map((entry, i) => {
+ return (
+ <ToggleComponent
+ key={i}
+ checked={entry.checked}
+ name = {entry.name}
+ onToggleChanged={() => this.setOption(entry)}/>
+ );
+ })}
+ </div>
+ );
+ }
+}
+
+
var ReportsMenu = React.createClass({
statics: {
title: "Visualization",
@@ -349,7 +387,7 @@ var FileMenu = React.createClass({
});
-var header_entries = [MainMenu, ViewMenu /*, ReportsMenu */];
+var header_entries = [MainMenu, ViewMenu, OptionMenu /*, ReportsMenu */];
export var Header = React.createClass({
@@ -380,7 +418,7 @@ export var Header = React.createClass({
href="#"
className={className}
onClick={this.handleClick.bind(this, entry)}>
- { entry.title}
+ {entry.title}
</a>
);
}.bind(this));