This code is a simple implementation of the flatten function for Nodejs. There are no external dependencies.
the assert library is used for testing to avoid external dependencies.
To test the function simple run node test.js
with node 6.x.x
If you want to use the function, just import the library:
const flatten = require('./flatten');
console.log(flatten([1,2,[3]])