1.0.0-rc.1 • Published 5 years ago

babel-plugin-smoosh v1.0.0-rc.1

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

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]