1.0.1 • Published 1 year ago

@jswork/next-max-by v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

next-max-by

This method is like _.max except that it accepts iteratee which is invoked for each element in array to generate the criterion by which the value is ranked.

version license size download

installation

yarn add @jswork/next-max-by

usage

import '@jswork/next-max-by';

const arr = [
  { name: 'apple', value: 1 },
  { name: 'banana', value: 2 },
  { name: 'orange', value: 3 },
  { name: 'pear', value: 4 },
  { name: 'grape', value: 5 }
];

const result = nx.maxBy(arr, (x) => x.value);
console.log(result);
// { name: 'grape', value: 5 }

license

Code released under the MIT license.

1.0.1

1 year ago