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.
36 lines
1.5 KiB
36 lines
1.5 KiB
'use strict'; |
|
var ctx = require('./$.ctx') |
|
, $export = require('./$.export') |
|
, toObject = require('./$.to-object') |
|
, call = require('./$.iter-call') |
|
, isArrayIter = require('./$.is-array-iter') |
|
, toLength = require('./$.to-length') |
|
, getIterFn = require('./core.get-iterator-method'); |
|
$export($export.S + $export.F * !require('./$.iter-detect')(function(iter){ Array.from(iter); }), 'Array', { |
|
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) |
|
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ |
|
var O = toObject(arrayLike) |
|
, C = typeof this == 'function' ? this : Array |
|
, $$ = arguments |
|
, $$len = $$.length |
|
, mapfn = $$len > 1 ? $$[1] : undefined |
|
, mapping = mapfn !== undefined |
|
, index = 0 |
|
, iterFn = getIterFn(O) |
|
, length, result, step, iterator; |
|
if(mapping)mapfn = ctx(mapfn, $$len > 2 ? $$[2] : undefined, 2); |
|
// if object isn't iterable or it's array with default iterator - use simple case |
|
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ |
|
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ |
|
result[index] = mapping ? call(iterator, mapfn, [step.value, index], true) : step.value; |
|
} |
|
} else { |
|
length = toLength(O.length); |
|
for(result = new C(length); length > index; index++){ |
|
result[index] = mapping ? mapfn(O[index], index) : O[index]; |
|
} |
|
} |
|
result.length = index; |
|
return result; |
|
} |
|
});
|
|
|