This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
851 B
47 lines
851 B
6 years ago
|
# array-reduce
|
||
|
|
||
|
`[].reduce()` for old browsers
|
||
|
|
||
|
[![testling badge](https://ci.testling.com/substack/array-reduce.png)](https://ci.testling.com/substack/array-reduce)
|
||
|
|
||
|
[![build status](https://secure.travis-ci.org/substack/array-reduce.png)](http://travis-ci.org/substack/array-reduce)
|
||
|
|
||
|
# example
|
||
|
|
||
|
```
|
||
|
var reduce = require('array-reduce');
|
||
|
var xs = [ 1, 2, 3, 4 ];
|
||
|
var sum = reduce(xs, function (acc, x) { return acc + x }, 0);
|
||
|
console.log(sum);
|
||
|
```
|
||
|
|
||
|
output:
|
||
|
|
||
|
```
|
||
|
10
|
||
|
```
|
||
|
|
||
|
# methods
|
||
|
|
||
|
``` js
|
||
|
var reduce = require('array-reduce')
|
||
|
```
|
||
|
|
||
|
## var res = reduce(xs, f, init)
|
||
|
|
||
|
Create a result `res` by folding `acc = f(acc, xs[i], i)` over each element in
|
||
|
the array `xs` at element `i`. If `init` is given, the first `acc` value is
|
||
|
`init`, otherwise `xs[0]` is used.
|
||
|
|
||
|
# install
|
||
|
|
||
|
With [npm](https://npmjs.org) do:
|
||
|
|
||
|
```
|
||
|
npm install array-reduce
|
||
|
```
|
||
|
|
||
|
# license
|
||
|
|
||
|
MIT
|