Guest User

Untitled

a guest
May 16th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. const isArr = arg => Object.prototype.toString.call(arg) === '[object Array]'
  2. const flat = inputAny =>
  3. (
  4. isArr(inputAny[0])
  5. ? flat(inputAny[0])
  6. : [inputAny[0]]
  7. )
  8. .concat(
  9. inputAny.length > 1
  10. ? flat(inputAny.slice(1))
  11. : []
  12. )
  13. export default flat
Add Comment
Please, Sign In to add comment