mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
@@ -60,6 +60,17 @@ export function utilArrayChunk(a, chunkSize) {
|
||||
}
|
||||
|
||||
|
||||
// Flattens two level array into a single level
|
||||
// var a = [[1,2,3],[4,5,6],[7]];
|
||||
// utilArrayFlatten(a);
|
||||
// [1,2,3,4,5,6,7];
|
||||
export function utilArrayFlatten(a) {
|
||||
return a.reduce(function(acc, val) {
|
||||
return acc.concat(val);
|
||||
}, []);
|
||||
}
|
||||
|
||||
|
||||
// Groups the items of the Array according to the given key
|
||||
// `key` can be passed as a property or as a key function
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user