drwpow / babel-plugin-smoosh

Permission to smoosh: granted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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]

About

Permission to smoosh: granted


Languages

Language:JavaScript 68.1%Language:TypeScript 31.9%