Rename param props to paths.

This commit is contained in:
John-David Dalton
2016-11-06 17:51:24 -08:00
parent c6ff776147
commit 57703b040d

View File

@@ -2587,7 +2587,7 @@
*
* @private
* @param {Object} object The object to iterate over.
* @param {string[]} paths The property paths of elements to pick.
* @param {string[]} paths The property paths to pick.
* @returns {Array} Returns the picked elements.
*/
function baseAt(object, paths) {
@@ -3751,13 +3751,13 @@
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property identifiers to pick.
* @param {string[]} paths The property paths to pick.
* @returns {Object} Returns the new object.
*/
function basePick(object, props) {
function basePick(object, paths) {
object = Object(object);
return basePickBy(object, props, function(value, key) {
return hasIn(object, key);
return basePickBy(object, paths, function(value, path) {
return hasIn(object, path);
});
}
@@ -3766,21 +3766,21 @@
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property identifiers to pick from.
* @param {string[]} paths The property paths to pick.
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, props, predicate) {
function basePickBy(object, paths, predicate) {
var index = -1,
length = props.length,
length = paths.length,
result = {};
while (++index < length) {
var key = props[index],
value = baseGet(object, key);
var path = paths[index],
value = baseGet(object, path);
if (predicate(value, key)) {
baseSet(result, key, value);
if (predicate(value, path)) {
baseSet(result, path, value);
}
}
return result;
@@ -8781,7 +8781,7 @@
* @memberOf _
* @since 1.0.0
* @category Seq
* @param {...(string|string[])} [paths] The property paths of elements to pick.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
@@ -12692,7 +12692,7 @@
* @since 1.0.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {...(string|string[])} [paths] The property paths of elements to pick.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Array} Returns the picked values.
* @example
*
@@ -13419,15 +13419,14 @@
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable string keyed properties of `object` that are
* not omitted.
* own and inherited enumerable property paths of `object` that are not omitted.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [props] The property identifiers to omit.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
@@ -13436,12 +13435,12 @@
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, props) {
var omit = flatRest(function(object, paths) {
if (object == null) {
return {};
}
props = arrayMap(props, toKey);
return basePick(object, baseDifference(getAllKeysIn(object), props));
paths = arrayMap(paths, toKey);
return basePick(object, baseDifference(getAllKeysIn(object), paths));
});
/**
@@ -13476,7 +13475,7 @@
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [props] The property identifiers to pick.
* @param {...(string|string[])} [paths] The property paths to pick.
* @returns {Object} Returns the new object.
* @example
*
@@ -13485,8 +13484,8 @@
* _.pick(object, ['a', 'c']);
* // => { 'a': 1, 'c': 3 }
*/
var pick = flatRest(function(object, props) {
return object == null ? {} : basePick(object, arrayMap(props, toKey));
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, arrayMap(paths, toKey));
});
/**