Version 1
[yaffs-website] / node_modules / uncss / node_modules / lodash / sortedIndexOf.js
diff --git a/node_modules/uncss/node_modules/lodash/sortedIndexOf.js b/node_modules/uncss/node_modules/lodash/sortedIndexOf.js
new file mode 100644 (file)
index 0000000..d8064ff
--- /dev/null
@@ -0,0 +1,30 @@
+var baseSortedIndex = require('./internal/baseSortedIndex'),
+    eq = require('./eq');
+
+/**
+ * This method is like `_.indexOf` except that it performs a binary
+ * search on a sorted `array`.
+ *
+ * @static
+ * @memberOf _
+ * @category Array
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns the index of the matched value, else `-1`.
+ * @example
+ *
+ * _.sortedIndexOf([1, 1, 2, 2], 2);
+ * // => 2
+ */
+function sortedIndexOf(array, value) {
+  var length = array ? array.length : 0;
+  if (length) {
+    var index = baseSortedIndex(array, value);
+    if (index < length && eq(array[index], value)) {
+      return index;
+    }
+  }
+  return -1;
+}
+
+module.exports = sortedIndexOf;