@kingjs/linq.min
v1.0.6
Published
Returns the minimum value in a sequence of values projected from elements of a sequence.
Downloads
6
Readme
@kingjs/linq.max
Returns the minimum value in a sequence of values projected from elements of a sequence.
Usage
Return the minimum value of 1
, 2
, 3
like this:
var max = require('@kingjs/linq.max');
var sequence = require('@kingjs/enumerable.create');
max.call(sequence(1, 2, 3));
result:
1
Return the oldest person like this:
var max = require('@kingjs/linq.max');
var sequence = require('@kingjs/enumerable.create');
var compareAge = function(l, r) { return l.age < r.age; }
max.call(sequence(
{ name: 'Alice', age: 18 },
{ name: 'Bob', age: 18 },
{ name: 'Chris', age: 19 },
), compareAge);
result:
{ name: 'Alice', age: 18 }
API
declare function min(
this: Enumerable,
lessThan?: (l, r) => boolean
)
Interfaces
Enumerable
: See @kingjs/enumerable.define.
Parameters
this
: Sequence to search for max element.lessThan
: Optional element comparison function.
Return Value
The minimum element.
Install
With npm installed, run
$ npm install @kingjs/linq.min
Acknowledgments
Like Enumerable.Min.
License
MIT