# babel-plugin-auto-argument

> [![GitHub stars](https://img.shields.io/github/stars/HuQingyang/babel-plugin-auto-argument.svg?style=social&label=Stars&style=plastic)](https://github.com/HuQingyang/babel-plugin-auto-argument) [![GitHub forks](https://img.shields.io/github/forks/HuQingya

Latest version **0.0.2** (published 2017-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-auto-argument
pnpm add babel-plugin-auto-argument
yarn add babel-plugin-auto-argument
bun add babel-plugin-auto-argument
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2017-11-01 |
| First published | 2017-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | huqingyang |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-auto-argument
- npm.io page: https://npm.io/package/babel-plugin-auto-argument

## Recent versions

- 0.0.2 (latest) — 2017-11-01
- 0.0.1 — 2017-11-01

## README

# Using auto argument in JavaScript like Scala

[![GitHub stars](https://img.shields.io/github/stars/HuQingyang/babel-plugin-auto-argument.svg?style=social&label=Stars&style=plastic)](https://github.com/HuQingyang/babel-plugin-auto-argument)
[![GitHub forks](https://img.shields.io/github/forks/HuQingyang/babel-plugin-auto-argument.svg?style=social&label=Fork&style=plastic)](https://github.com/HuQingyang/babel-plugin-auto-argument)
[![npm](https://img.shields.io/npm/dw/babel-plugin-auto-argument.svg)](https://www.npmjs.com/package/babel-plugin-auto-argument)
[![npm](https://img.shields.io/npm/v/babel-plugin-auto-argument.svg)](https://www.npmjs.com/package/babel-plugin-auto-argument)
[![npm](https://img.shields.io/npm/l/babel-plugin-auto-argument.svg)](https://www.npmjs.com/package/babel-plugin-auto-argument)

**See Also:**
* Using two-way data binding in JSX: [babel-plugin-jsx-two-way-binding](https://github.com/HuQingyang/babel-plugin-jsx-two-way-binding) 
* Using for-directive in JSX: [babel-plugin-jsx-for-directive](https://github.com/HuQingyang/babel-plugin-jsx-for-directive)
* Using if-directive in JSX: [babel-plugin-jsx-if-directive](https://github.com/HuQingyang/babel-plugin-jsx-if-directive)


## 1. Install
`npm install --save-dev babel-plugin-auto-argument`

## 2. Basic Usage
Edit your __.babelrc__ file:
```json
{
  "plugins": [
    "auto-argument"
  ]
}
```
In your js file:
```js
[1, 2, 3].map(_ * 2)
```
And it will be compiled to:
```js
[1, 2, 3].map(function (_) { 
    return _ * 2
})
```

In your js file:
```js
const a = [
    [1, 2],
    [3, 4, 5],
    [6, 7, 8, 9]
].filter(_.length <= 3).map(_.filter(10 % _ === 0));
console.log(a);
```
And it will print:
```js
[
    [1, 2],
    [5]
]
```

## 3. Usage with custom variable name
Edit your __.babelrc__ file:
```json
{
  "plugins": [
    "auto-argument",
    {
      "variableName": "$"
    }
  ]
}
```
In your js file:
```js
[1, 2, 3].map($ * 2)
```

---
_Source: https://npm.io/package/babel-plugin-auto-argument · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
