Fixed error prone checking etc in codebase
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
const flatten = (arr, depth = 1) =>
|
||||
depth != 1
|
||||
depth !== 1
|
||||
? arr.reduce((a, v) => a.concat(Array.isArray(v) ? flatten(v, depth - 1) : v), [])
|
||||
: arr.reduce((a, v) => a.concat(v), []);
|
||||
module.exports = flatten;
|
||||
Reference in New Issue
Block a user