Tweak docs for _.property and _.propertyOf. [ci skip]

This commit is contained in:
John-David Dalton
2014-11-08 08:45:27 -08:00
parent 404e658a5d
commit 30f0232d71

View File

@@ -9550,8 +9550,8 @@
} }
/** /**
* Creates a "_.pluck" style function which returns the value associated with * Creates a "_.pluck" style function which returns the property value
* the `key` of a given object. * of `key` on a given object.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -9568,10 +9568,10 @@
* var getName = _.property('user'); * var getName = _.property('user');
* *
* _.map(users, getName); * _.map(users, getName);
* // => ['barney', 'fred'] * // => ['fred', barney']
* *
* _.sortBy(users, getName); * _.pluck(_.sortBy(users, getName), 'user');
* // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] * // => ['barney', 'fred']
*/ */
function property(key) { function property(key) {
key = String(key); key = String(key);
@@ -9582,7 +9582,7 @@
/** /**
* The inverse of `_.property`; this method creates a function which returns * The inverse of `_.property`; this method creates a function which returns
* the value associated with a given key of `object`. * the property value of a given key on `object`.
* *
* @static * @static
* @memberOf _ * @memberOf _
@@ -9592,7 +9592,7 @@
* @example * @example
* *
* var fred = { 'user': 'fred', 'age': 40, 'active': true }; * var fred = { 'user': 'fred', 'age': 40, 'active': true };
* _.map(['age', 'active', _.propertyOf(fred)); * _.map(['age', 'active'], _.propertyOf(fred));
* // => [40, true] * // => [40, true]
* *
* var object = { 'a': 3, 'b': 1, 'c': 2 }; * var object = { 'a': 3, 'b': 1, 'c': 2 };