Remove lodash flatten and flattenDeep

(re: #6087)
This commit is contained in:
Bryan Housel
2019-03-28 10:03:59 -04:00
parent f4367f96c0
commit d18b951c67
6 changed files with 55 additions and 39 deletions
+11
View File
@@ -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
//