Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active February 12, 2019 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilmoore/e5a4eb459df82843c9b18be704336589 to your computer and use it in GitHub Desktop.
Save wilmoore/e5a4eb459df82843c9b18be704336589 to your computer and use it in GitHub Desktop.
flatten kata
exports.flatten = (input) => input.toString().split(',').map(Number)
const assert = require('assert')
const { flatten } = require('./index')
assert.deepEqual(flatten([[1, 2, [3]], 4]), [1, 2, 3, 4])
assert.deepEqual(flatten([[1, 2, [3, 4]], 5]), [1, 2, 3, 4, 5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment