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