Recursively flatten arrays! npm install just-flatten var flatten = require('just-flatten') Usage flatten([[1,2,[3]],4]) // => [1,2,3,4] The function expects a single argument: an array to be flattened. Any other value is returned as-is. License WTFPL