ran npm tdd

This commit is contained in:
King
2018-01-11 05:27:49 -05:00
parent 3c2361e54b
commit 086005917d
6 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
module.exports = flattenDepth = (arr, depth = 1) =>
depth != 1
? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flattenDepth(v, depth - 1) : v), [])
: arr.reduce((a, v) => a.concat(v), []);