Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drwpow/babel-plugin-smoosh
Permission to smoosh: granted
https://github.com/drwpow/babel-plugin-smoosh
Last synced: 9 days ago
JSON representation
Permission to smoosh: granted
- Host: GitHub
- URL: https://github.com/drwpow/babel-plugin-smoosh
- Owner: drwpow
- Created: 2019-01-24T04:32:49.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2022-04-22T04:22:56.000Z (over 2 years ago)
- Last Synced: 2024-12-01T05:49:02.092Z (26 days ago)
- Language: JavaScript
- Size: 48.8 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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:
```json
{
"plugins": ["smoosh"]
}
```### Usage
```js
const myArray = [1, 2, [3, 4]];
myArray.smoosh(); // [1, 2, 3, 4]
``````js
const myArray = [1, 2, [3, 4];
myArray.smooshMap(x => [x * 2]) // [2, 4, 6, 8]
```