@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.

Stats

StarsIssuesVersionUpdatedCreatedSize
@kingjs/linq.aggregate
1.0.213 years ago3 years agoMinified + gzip package size for @kingjs/linq.aggregate in KB

Readme

@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: An IEnumerable 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

Analytics

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.