Bump to v3.7.0.

This commit is contained in:
jdalton
2015-04-15 20:56:31 -07:00
parent 801ffd8adf
commit 5eb8db31d7
121 changed files with 897 additions and 413 deletions

View File

@@ -1,30 +1,31 @@
import baseProperty from '../internal/baseProperty';
import basePropertyDeep from '../internal/basePropertyDeep';
import isKey from '../internal/isKey';
/**
* Creates a function which returns the property value of `key` on a given object.
* Creates a function which returns the property value at `path` on a
* given object.
*
* @static
* @memberOf _
* @category Utility
* @param {string} key The key of the property to get.
* @param {Array|string} path The path of the property to get.
* @returns {Function} Returns the new function.
* @example
*
* var users = [
* { 'user': 'fred' },
* { 'user': 'barney' }
* var objects = [
* { 'a': { 'b': { 'c': 2 } } },
* { 'a': { 'b': { 'c': 1 } } }
* ];
*
* var getName = _.property('user');
* _.map(objects, _.property('a.b.c'));
* // => [2, 1]
*
* _.map(users, getName);
* // => ['fred', 'barney']
*
* _.pluck(_.sortBy(users, getName), 'user');
* // => ['barney', 'fred']
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
* // => [1, 2]
*/
function property(key) {
return baseProperty(key + '');
function property(path) {
return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
}
export default property;