summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/lodash/internal/createCache.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/lodash/internal/createCache.js')
-rw-r--r--deps/npm/node_modules/lodash/internal/createCache.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/deps/npm/node_modules/lodash/internal/createCache.js b/deps/npm/node_modules/lodash/internal/createCache.js
new file mode 100644
index 0000000000..025e5662ab
--- /dev/null
+++ b/deps/npm/node_modules/lodash/internal/createCache.js
@@ -0,0 +1,21 @@
+var SetCache = require('./SetCache'),
+ getNative = require('./getNative');
+
+/** Native method references. */
+var Set = getNative(global, 'Set');
+
+/* Native method references for those with the same name as other `lodash` methods. */
+var nativeCreate = getNative(Object, 'create');
+
+/**
+ * Creates a `Set` cache object to optimize linear searches of large arrays.
+ *
+ * @private
+ * @param {Array} [values] The values to cache.
+ * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.
+ */
+function createCache(values) {
+ return (nativeCreate && Set) ? new SetCache(values) : null;
+}
+
+module.exports = createCache;