Json Object 에서 특정 key 값의 최대, 최소 값 구하기 


https://lodash.com/



_.minBy(array, [iteratee=_.identity])


_.maxBy(array, [iteratee=_.identity])


var objects = [{ 'n'1 }, { 'n'2 }];
 
_.maxBy(objects, function(o) { return o.n; });
// => { 'n': 2 }
 
// The `_.property` iteratee shorthand.
_.maxBy(objects, 'n');
// => { 'n': 2 }


var objects = [{ 'n'1 }, { 'n'2 }];
 
_.minBy(objects, function(o) { return o.n; });
// => { 'n': 1 }
 
// The `_.property` iteratee shorthand.
_.minBy(objects, 'n');
// => { 'n': 1 }


참고 https://stackoverflow.com/questions/33351934/get-the-min-and-max-from-array-of-objects-with-underscore-js


https://lodash.com/docs/4.17.11#minBy

https://lodash.com/docs/4.17.11#maxBy

블로그 이미지

클라인STR

,