Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-smoosh

dangodev7ISC1.0.0-rc.1

Permission to Smoosh: granted

smoosh, flatten, flatmap, smooshmap

readme

babel-plugin-smoosh

Lets intellectuals use Array.prototype.smoosh() and Array.prototype.smooshMap() instead of Array.prototype.flat() and Array.prototype.flatMap().

Installation

npm i --save-dev babel-plugin-smoosh

Add the following to your .babelrc or .babelrc.js file:

{
  "plugins": ["smoosh"]
}

Usage

const myArray = [1, 2, [3, 4]];
myArray.smoosh(); // [1, 2, 3, 4]
const myArray = [1, 2, [3, 4];
myArray.smooshMap(x => [x * 2]) // [2, 4, 6, 8]