mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Tweak docs for _.property and _.propertyOf. [ci skip]
This commit is contained in:
14
lodash.js
14
lodash.js
@@ -9550,8 +9550,8 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a "_.pluck" style function which returns the value associated with
|
||||
* the `key` of a given object.
|
||||
* Creates a "_.pluck" style function which returns the property value
|
||||
* of `key` on a given object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
@@ -9568,10 +9568,10 @@
|
||||
* var getName = _.property('user');
|
||||
*
|
||||
* _.map(users, getName);
|
||||
* // => ['barney', 'fred']
|
||||
* // => ['fred', barney']
|
||||
*
|
||||
* _.sortBy(users, getName);
|
||||
* // => [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }]
|
||||
* _.pluck(_.sortBy(users, getName), 'user');
|
||||
* // => ['barney', 'fred']
|
||||
*/
|
||||
function property(key) {
|
||||
key = String(key);
|
||||
@@ -9582,7 +9582,7 @@
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @memberOf _
|
||||
@@ -9592,7 +9592,7 @@
|
||||
* @example
|
||||
*
|
||||
* var fred = { 'user': 'fred', 'age': 40, 'active': true };
|
||||
* _.map(['age', 'active', _.propertyOf(fred));
|
||||
* _.map(['age', 'active'], _.propertyOf(fred));
|
||||
* // => [40, true]
|
||||
*
|
||||
* var object = { 'a': 3, 'b': 1, 'c': 2 };
|
||||
|
||||
Reference in New Issue
Block a user