Last active
February 12, 2019 23:28
-
-
Save wilmoore/e5a4eb459df82843c9b18be704336589 to your computer and use it in GitHub Desktop.
flatten kata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.flatten = (input) => input.toString().split(',').map(Number) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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