ran npm tdd

This commit is contained in:
King
2018-01-11 05:27:49 -05:00
parent 8fd7e51ede
commit 7c805e941a
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), []);