Skip to content

Instantly share code, notes, and snippets.

@kulicuu
Created July 1, 2016 14:19
Show Gist options
  • Select an option

  • Save kulicuu/a156656dd90f7d6879a6f52f4d823476 to your computer and use it in GitHub Desktop.

Select an option

Save kulicuu/a156656dd90f7d6879a6f52f4d823476 to your computer and use it in GitHub Desktop.
\0__0/ FLATTEN ALL THE RAYYS !!!!! \0__0/
c = -> console.log.apply console, arguments
test_rayy = [[3], [33, 88,[3939, 393], 83333], 8938, 93838]
exports.flatten = cursive_flatten = (acc, rayy) ->
for item in rayy
if Object.prototype.toString.call(item) is '[object Array]'
acc = arguments.callee(acc, item)
else
acc.push item
return acc
c 'flatt!!!: ', cursive_flatten([], test_rayy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment