Update sortedIndex method doc examples. [ci skip]

This commit is contained in:
John-David Dalton
2016-05-21 11:55:10 -07:00
parent 4ed722ccd8
commit 803dce242b

View File

@@ -7205,9 +7205,6 @@
* *
* _.sortedIndex([30, 50], 40); * _.sortedIndex([30, 50], 40);
* // => 1 * // => 1
*
* _.sortedIndex([4, 5], 4);
* // => 0
*/ */
function sortedIndex(array, value) { function sortedIndex(array, value) {
return baseSortedIndex(array, value); return baseSortedIndex(array, value);
@@ -7230,13 +7227,13 @@
* into `array`. * into `array`.
* @example * @example
* *
* var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 }; * var objects = [{ 'x': 4 }, { 'x': 5 }];
* *
* _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict)); * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
* // => 1 * // => 0
* *
* // The `_.property` iteratee shorthand. * // The `_.property` iteratee shorthand.
* _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
* // => 0 * // => 0
*/ */
function sortedIndexBy(array, value, iteratee) { function sortedIndexBy(array, value, iteratee) {
@@ -7256,8 +7253,8 @@
* @returns {number} Returns the index of the matched value, else `-1`. * @returns {number} Returns the index of the matched value, else `-1`.
* @example * @example
* *
* _.sortedIndexOf([1, 1, 2, 2], 2); * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
* // => 2 * // => 1
*/ */
function sortedIndexOf(array, value) { function sortedIndexOf(array, value) {
var length = array ? array.length : 0; var length = array ? array.length : 0;
@@ -7285,8 +7282,8 @@
* into `array`. * into `array`.
* @example * @example
* *
* _.sortedLastIndex([4, 5], 4); * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
* // => 1 * // => 4
*/ */
function sortedLastIndex(array, value) { function sortedLastIndex(array, value) {
return baseSortedIndex(array, value, true); return baseSortedIndex(array, value, true);
@@ -7309,8 +7306,13 @@
* into `array`. * into `array`.
* @example * @example
* *
* var objects = [{ 'x': 4 }, { 'x': 5 }];
*
* _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
* // => 1
*
* // The `_.property` iteratee shorthand. * // The `_.property` iteratee shorthand.
* _.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x'); * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
* // => 1 * // => 1
*/ */
function sortedLastIndexBy(array, value, iteratee) { function sortedLastIndexBy(array, value, iteratee) {
@@ -7330,7 +7332,7 @@
* @returns {number} Returns the index of the matched value, else `-1`. * @returns {number} Returns the index of the matched value, else `-1`.
* @example * @example
* *
* _.sortedLastIndexOf([1, 1, 2, 2], 2); * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
* // => 3 * // => 3
*/ */
function sortedLastIndexOf(array, value) { function sortedLastIndexOf(array, value) {