Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sortedIndexOf.js 762B

12345678910111213141516171819202122232425262728293031
  1. var baseSortedIndex = require('./_baseSortedIndex'),
  2. eq = require('./eq');
  3. /**
  4. * This method is like `_.indexOf` except that it performs a binary
  5. * search on a sorted `array`.
  6. *
  7. * @static
  8. * @memberOf _
  9. * @since 4.0.0
  10. * @category Array
  11. * @param {Array} array The array to inspect.
  12. * @param {*} value The value to search for.
  13. * @returns {number} Returns the index of the matched value, else `-1`.
  14. * @example
  15. *
  16. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  17. * // => 1
  18. */
  19. function sortedIndexOf(array, value) {
  20. var length = array == null ? 0 : array.length;
  21. if (length) {
  22. var index = baseSortedIndex(array, value);
  23. if (index < length && eq(array[index], value)) {
  24. return index;
  25. }
  26. }
  27. return -1;
  28. }
  29. module.exports = sortedIndexOf;