Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maxhallinan/flattin

Flatten nested arrays into a new array.
https://github.com/maxhallinan/flattin

Last synced: about 1 month ago
JSON representation

Flatten nested arrays into a new array.

Awesome Lists containing this project

README

        

# flattin

Flatten arbitrarily nested arrays into a new array.

This implementation avoids `Array` and `Array.prototype` methods, and spread/rest.
Just for fun.

## Usage

```js
const flattin = require('flattin');

flattin([[1, 2, [3]], 4]);
//=> [1, 2, 3, 4]
```

## API

### flattin(array)

#### array

Type: `Array`

The array to flatten.