Flatten an array or array-like object
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
index.js
package.json
test.js

README.md

flatten-list

NPM

Build Status Dependency Status

Flatten an array or array-like objects.

Reduces nested arrays or array-like objects (like arguments or NodeList in the browser) to a single array.

Example

var flatten = require('flatten-list');

flatten([1, [2, 3]]); // [1, 2, 3]
flatten([1, 2, 3]); // [1, 2, 3]
flatten(1); // [1]

function test() {
    return flatten(arguments);
}

test(1, [2, 3]); // [1, 2, 3];