
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
Flatten a nested array.
The nesting can be to any depth. If you pass shallow, the array will only be flattened one level.
Install with npm
$ npm install flat-util
Or unpkg
<script src="https://unpkg.com/flat-util@1.1.9/umd/index.js" />
Check out the unit tests on CodePen.
const flatten = require('flat-util');
flatten([1, 2, [3, 4]]);
//=> [1, 2, 3, 4]
flatten([1, [2], [3, [[4]]]]);
//=> [1, 2, 3, 4];
flatten([1, [2], [3, [[4]]]], true);
//=> [1, 2, 3, [[4]]];
| Like us a lot? Help others know why you like us! Review this package on pkgreview.dev | ➡ | ![]() |
|---|
Type: array
Default: none
The array to flatten.
Type: boolean
Default: false
Whether or not to flatten the array only one level.
MIT
FAQs
Flatten a nested array.
The npm package flat-util receives a total of 298,374 weekly downloads. As such, flat-util popularity was classified as popular.
We found that flat-util demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.