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.
19 lines
891 B
19 lines
891 B
var ctx = require('./$.ctx') |
|
, call = require('./$.iter-call') |
|
, isArrayIter = require('./$.is-array-iter') |
|
, anObject = require('./$.an-object') |
|
, toLength = require('./$.to-length') |
|
, getIterFn = require('./core.get-iterator-method'); |
|
module.exports = function(iterable, entries, fn, that){ |
|
var iterFn = getIterFn(iterable) |
|
, f = ctx(fn, that, entries ? 2 : 1) |
|
, index = 0 |
|
, length, step, iterator; |
|
if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!'); |
|
// fast case for arrays with default iterator |
|
if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){ |
|
entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); |
|
} else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){ |
|
call(iterator, f, step.value, entries); |
|
} |
|
}; |