1.0.3 • Published 1 year ago

@jswork/next-min-by v1.0.3

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

next-min-by

This method is like _.min 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-min-by

usage

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

// given an array of objects
const arr = [
  { name: 'apple', value: 10 },
  { name: 'banana', value: 20 },
  { name: 'orange', value: 15 },
  { name: 'pear', value: 25 }
];

// find the min value by `value` property
const result = nx.minBy(arr, 'value');
// result: { name: 'apple', value: 10 }  

// find the min value by function
const result2 = nx.minBy(arr, (item) =>item.value);
// result: { name: 'apple', value: 10 }  

license

Code released under the MIT license.

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago