https://github.com/spiffgreen/flat-arr
Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.
https://github.com/spiffgreen/flat-arr
array flatten-array recursive-algorithm
Last synced: 4 months ago
JSON representation
Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.
- Host: GitHub
- URL: https://github.com/spiffgreen/flat-arr
- Owner: SpiffGreen
- License: mit
- Created: 2021-07-28T00:56:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-28T01:02:43.000Z (almost 4 years ago)
- Last Synced: 2025-01-03T05:41:23.718Z (6 months ago)
- Topics: array, flatten-array, recursive-algorithm
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Flat Array
Flatten an array of arrays into one or more. It flexible enough that you can dictate the maximum depth it unveils.### Installation
In using npm in your project, run:
```sh
$ npm install flat-arr --save
```Include the module to use
```js
const flatArr = require("flat-arr");
```### Example
```js
const arr = [
[1, 2, 3],
[4, 5, 6],
7, 8, 9,
[10,
[11,
[12,
[13, 14, 15]
],
16,
],
17,
],
18
];console.log(flatArr(arr, 3));
// [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, [ 13, 14, 15 ], 16, 17, 18 ]console.log(flatArr(arr));
/* [
1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18
] */
```### Manual Release Steps
* Increment the "version" attribute of package.json
* Commit with the message "Release version x.x.x"
* Create version tag in git
* Create a github release
* Release on npm### Author
Spiff Jekey-Green### License
[MIT](./LICENSE) License