Basic usage

Given an array that contains many arrays, return a new array where all items from the children are present at the top level.

import { flat } from 'radash'

const gods = [
  ['ra', 'loki'],
  ['zeus']
]

flat(gods) // => [ra, loki, zeus]

Note, _.flat is not recursive and will not flatten children of children of children … of children. It will only flatten T[][] an array of arrays.

Testing

This _.flat function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.flat on GitHub.