mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +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
|
* 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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user