mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Cleanup _.maxBy and _.minBy doc example. [ci skip]
This commit is contained in:
26
lodash.js
26
lodash.js
@@ -13634,17 +13634,14 @@
|
|||||||
* @returns {*} Returns the maximum value.
|
* @returns {*} Returns the maximum value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
||||||
* { 'user': 'barney', 'age': 36 },
|
|
||||||
* { 'user': 'fred', 'age': 40 }
|
|
||||||
* ];
|
|
||||||
*
|
*
|
||||||
* _.maxBy(users, function(o) { return o.age; });
|
* _.maxBy(objects, function(o) { return o.a; });
|
||||||
* // => { 'user': 'fred', 'age': 40 }
|
* // => { 'n': 2 }
|
||||||
*
|
*
|
||||||
* // using the `_.property` iteratee shorthand
|
* // using the `_.property` iteratee shorthand
|
||||||
* _.maxBy(users, 'age');
|
* _.maxBy(objects, 'n');
|
||||||
* // => { 'user': 'fred', 'age': 40 }
|
* // => { 'n': 2 }
|
||||||
*/
|
*/
|
||||||
function maxBy(array, iteratee) {
|
function maxBy(array, iteratee) {
|
||||||
return (array && array.length)
|
return (array && array.length)
|
||||||
@@ -13705,17 +13702,14 @@
|
|||||||
* @returns {*} Returns the minimum value.
|
* @returns {*} Returns the minimum value.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* var users = [
|
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
||||||
* { 'user': 'barney', 'age': 36 },
|
|
||||||
* { 'user': 'fred', 'age': 40 }
|
|
||||||
* ];
|
|
||||||
*
|
*
|
||||||
* _.minBy(users, function(o) { return o.age; });
|
* _.minBy(objects, function(o) { return o.a; });
|
||||||
* // => { 'user': 'barney', 'age': 36 }
|
* // => { 'n': 1 }
|
||||||
*
|
*
|
||||||
* // using the `_.property` iteratee shorthand
|
* // using the `_.property` iteratee shorthand
|
||||||
* _.minBy(users, 'age');
|
* _.minBy(objects, 'n');
|
||||||
* // => { 'user': 'barney', 'age': 36 }
|
* // => { 'n': 1 }
|
||||||
*/
|
*/
|
||||||
function minBy(array, iteratee) {
|
function minBy(array, iteratee) {
|
||||||
return (array && array.length)
|
return (array && array.length)
|
||||||
|
|||||||
Reference in New Issue
Block a user