@recursive/flatten

1.0.1 • Public • Published

flatten

🍳 Flatten arrays of arrays, as long as all the members are arrays

const flatten = require('@recursive/flatten');

flatten([
	[
		[1, 2, 3],
		[4, 5, 6],
	],
	[
		[1, 2, 3],
		[4, 5, 6],
	],
	[
		[1, 2, 3],
		[4, 5, 6],
	],
]);
// [1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6]

Transpiled version

Environments which exclude node_modules from the transpiling pipeline should include the "browser" entry instead of "main". This exposes an ES5 commonjs module.

Also available for explicit import:

const flatten = require('@recursive/flatten/dist');

Package Sidebar

Install

npm i @recursive/flatten

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.63 kB

Total Files

4

Last publish

Collaborators

  • omrilotan