summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js')
-rw-r--r--deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js
new file mode 100644
index 0000000000..09f698ab8b
--- /dev/null
+++ b/deps/npm/node_modules/cli-table2/node_modules/lodash/internal/cacheIndexOf.js
@@ -0,0 +1,19 @@
+var isObject = require('../lang/isObject');
+
+/**
+ * Checks if `value` is in `cache` mimicking the return signature of
+ * `_.indexOf` by returning `0` if the value is found, else `-1`.
+ *
+ * @private
+ * @param {Object} cache The cache to search.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
+ */
+function cacheIndexOf(cache, value) {
+ var data = cache.data,
+ result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];
+
+ return result ? 0 : -1;
+}
+
+module.exports = cacheIndexOf;