Cleanup docs. [ci skip]

This commit is contained in:
John-David Dalton
2013-12-05 21:24:47 -08:00
parent bc4c043d7e
commit 088e199aa2
5 changed files with 174 additions and 89 deletions

View File

@@ -2535,15 +2535,15 @@
/**
* Creates an object composed of the inverted keys and values of the given
* object. If an object contains duplicate values, subsequent values will
* overwrite property assignments of previous values unless `multiValue`
* object. If the given object contains duplicate values, subsequent values
* will overwrite property assignments of previous values unless `multiValue`
* is `true`.
*
* @static
* @memberOf _
* @category Objects
* @param {Object} object The object to invert.
* @param {boolean} [multiValue=false] Allow multiple values per key in the inverted object.
* @param {boolean} [multiValue=false] Allow multiple values per key.
* @returns {Object} Returns the created inverted object.
* @example
*
@@ -4666,9 +4666,11 @@
* _.first([1, 2, 3]);
* // => 1
*
* // returns the first two elements
* _.first([1, 2, 3], 2);
* // => [1, 2]
*
* // returns elements from the beginning until the callback result is falsey
* _.first([1, 2, 3], function(num) {
* return num < 3;
* });
@@ -4736,6 +4738,7 @@
* _.flatten([1, [2], [3, [[4]]]]);
* // => [1, 2, 3, 4];
*
* // using `isShallow`
* _.flatten([1, [2], [3, [[4]]]], true);
* // => [1, 2, 3, [[4]]];
*
@@ -4779,9 +4782,11 @@
* _.indexOf([1, 2, 3, 1, 2, 3], 2);
* // => 1
*
* // using `fromIndex`
* _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
* // => 4
*
* // performing a binary search
* _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
* // => 2
*/
@@ -4824,9 +4829,11 @@
* _.initial([1, 2, 3]);
* // => [1, 2]
*
* // excludes the last two elements
* _.initial([1, 2, 3], 2);
* // => [1]
*
* // excludes elements from the end until the callback fails
* _.initial([1, 2, 3], function(num) {
* return num > 1;
* });
@@ -4954,9 +4961,11 @@
* _.last([1, 2, 3]);
* // => 3
*
* // returns the last two elements
* _.last([1, 2, 3], 2);
* // => [2, 3]
*
* // returns elements from the end until the callback fails
* _.last([1, 2, 3], function(num) {
* return num > 1;
* });
@@ -5019,6 +5028,7 @@
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
* // => 4
*
* // using `fromIndex`
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
* // => 1
*/
@@ -5203,9 +5213,11 @@
* _.rest([1, 2, 3]);
* // => [2, 3]
*
* // excludes the first two elements
* _.rest([1, 2, 3], 2);
* // => [3]
*
* // excludes elements from the beginning until the callback fails
* _.rest([1, 2, 3], function(num) {
* return num < 3;
* });
@@ -5271,23 +5283,25 @@
* _.sortedIndex([20, 30, 50], 40);
* // => 2
*
* // using "_.pluck" callback shorthand
* _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
* // => 2
*
* var dict = {
* 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
* };
*
* // using `callback`
* _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
* return dict.wordToNumber[word];
* });
* // => 2
*
* // using `callback` with `thisArg`
* _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
* return this.wordToNumber[word];
* }, dict);
* // => 2
*
* // using "_.pluck" callback shorthand
* _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
* // => 2
*/
function sortedIndex(array, value, callback, thisArg) {
var low = 0,
@@ -5355,12 +5369,15 @@
* _.uniq([1, 2, 1, 3, 1]);
* // => [1, 2, 3]
*
* // using `isSorted`
* _.uniq([1, 1, 2, 2, 3], true);
* // => [1, 2, 3]
*
* // using `callback`
* _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
* // => ['A', 'b', 'C']
*
* // using `callback` with `thisArg`
* _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
* // => [1, 2.5, 3]
*