[go: up one dir, main page]

@jswork/next-max-by

1.0.1 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i @jswork/next-max-by

Homepage

js.work

Weekly Downloads

9

Version

1.0.1

License

MIT

Unpacked Size

6.08 kB

Total Files

6

Last publish

Collaborators

  • afeiship