summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/lodash/_stackSet.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/node_modules/lodash/_stackSet.js')
-rw-r--r--tools/eslint/node_modules/lodash/_stackSet.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/eslint/node_modules/lodash/_stackSet.js b/tools/eslint/node_modules/lodash/_stackSet.js
new file mode 100644
index 0000000000..0194d100f4
--- /dev/null
+++ b/tools/eslint/node_modules/lodash/_stackSet.js
@@ -0,0 +1,36 @@
+var MapCache = require('./_MapCache'),
+ assocSet = require('./_assocSet');
+
+/** Used as the size to enable large array optimizations. */
+var LARGE_ARRAY_SIZE = 200;
+
+/**
+ * Sets the stack `key` to `value`.
+ *
+ * @private
+ * @name set
+ * @memberOf Stack
+ * @param {string} key The key of the value to set.
+ * @param {*} value The value to set.
+ * @returns {Object} Returns the stack cache object.
+ */
+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);
+ }
+ return this;
+}
+
+module.exports = stackSet;