Tweak argument names and docs.

Former-commit-id: 38d7f9cc7dea76e038ede22b6c6b4e779e28237b
This commit is contained in:
John-David Dalton
2013-04-02 22:37:40 -07:00
parent e76360c1b5
commit ca28aa6ebd
7 changed files with 219 additions and 121 deletions

View File

@@ -1264,7 +1264,7 @@
* @static
* @memberOf _
* @category Objects
* @param {Array|Object|String} collection The collection to iterate over.
* @param {Object} object The object to search.
* @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively.
@@ -1275,11 +1275,11 @@
* _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { return num % 2 == 0; });
* // => 'b'
*/
function findKey(collection, callback, thisArg) {
function findKey(object, callback, thisArg) {
var result;
callback = lodash.createCallback(callback, thisArg);
forOwn(collection, function(value, key, collection) {
if (callback(value, key, collection)) {
forOwn(object, function(value, key, object) {
if (callback(value, key, object)) {
result = key;
return false;
}
@@ -3307,7 +3307,7 @@
* @static
* @memberOf _
* @category Arrays
* @param {Array|Object|String} collection The collection to iterate over.
* @param {Array} array The array to search.
* @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create
* a "_.pluck" or "_.where" style callback, respectively.
@@ -3315,16 +3315,18 @@
* @returns {Mixed} Returns the index of the found element, else `-1`.
* @example
*
* _.findIndex(['apple', 'banana', 'beet'], function(food) { return /^b/.test(food); });
* _.findIndex(['apple', 'banana', 'beet'], function(food) {
* return /^b/.test(food);
* });
* // => 1
*/
function findIndex(collection, callback, thisArg) {
function findIndex(array, callback, thisArg) {
var index = -1,
length = collection ? collection.length : 0;
length = array ? array.length : 0;
callback = lodash.createCallback(callback, thisArg);
while (++index < length) {
if (callback(collection[index], index, collection)) {
if (callback(array[index], index, array)) {
return index;
}
}
@@ -3426,7 +3428,7 @@
* @static
* @memberOf _
* @category Arrays
* @param {Array} array The array to compact.
* @param {Array} array The array to flatten.
* @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
* @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create
@@ -3897,7 +3899,7 @@
* @static
* @memberOf _
* @category Arrays
* @param {Array} array The array to iterate over.
* @param {Array} array The array to inspect.
* @param {Mixed} value The value to evaluate.
* @param {Function|Object|String} [callback=identity] The function called per
* iteration. If a property name or object is passed, it will be used to create
@@ -5120,7 +5122,7 @@
}
/**
* The opposite of `_.escape`, this method converts the HTML entities
* The inverse of `_.escape`, this method converts the HTML entities
* `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
* corresponding characters.
*