1.0.21 • Published 5 years ago
@kingjs/linq.aggregate v1.0.21
@kingjs/linq.aggregate
Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value.
Usage
require('kingjs');
var assert = require('assert');
var Aggregate = require('@kingjs/linq.aggregate');
var sequence = [2, 3, 4];
var result = sequence[Aggregate](1, function(x) {
return this + x;
}, o => String(o));
assert(result === '10');
API
aggregate(this, seed, aggregator, selector)
Parameters
this
: AnIEnumerable
over which to aggregate.seed
: The initial accumulator value.aggregator
: An accumulator function to be invoked on each element.selector
: A function to transform the final accumulator value into the result value.
Returns
The transformed final accumulator value.
Install
With npm installed, run
$ npm install @kingjs/linq.aggregate
Dependencies
Package | Version |
---|---|
@kingjs/i-enumerable | ^1.0.6 |
@kingjs/i-enumerator | ^1.0.7 |
@kingjs/reflect.export-extension | ^1.0.1 |
Source
https://repository.kingjs.net/linq/aggregate
License
MIT
1.0.21
5 years ago
1.0.20
5 years ago
1.0.19
5 years ago
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
6 years ago
1.0.15
6 years ago
1.0.14
6 years ago
1.0.13
6 years ago
1.0.12
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago