flatten

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
4,043
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
N/A
Flattens `array` a single level deep.
2 contributors
Install flatten as a package?
Copied
npm i @bit/lodash.lodash.flatten
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
flatten (
array:Array
) : Array

Flattens array a single level deep.

Example
flatten([1, [2, [3, [4]], 5]])
// => [1, 2, [3, [4]], 5]
Argument
array: Array

The array to flatten.

Returns
Array

Returns the new flattened array.

Help and resources