<commit_before># babel-plugin-auto-assign

[![npm version](https://img.shields.io/npm/v/babel-plugin-auto-assign.svg)](https://www.npmjs.org/package/babel-plugin-auto-assign)
[![npm downloads](https://img.shields.io/npm/dm/babel-plugin-auto-assign.svg)](https://www.npmjs.org/package/babel-plugin-auto-assign)

A babel plugin that automatically assigns constructor parameters to instance properties. Might be convenient for class-based DI like Angular does.

Before:

```js
@autoAssign
class Hello {
  constructor(foo, bar, baz) {
  }
}
```

After:

```js
class Hello {
  constructor(foo, bar, baz) {
    this.foo = foo;
    this.bar = bar;
    this.baz = baz;
  }
}
```

## Installation

```sh
$ npm install babel-plugin-auto-assign
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "optional": ["es7.decorators"],
  "plugins": ["auto-assign"]
}
```

### Via CLI

```sh
$ babel --optional es7.decorators --plugins auto-assgin script.js
```

### Via Node API

```js
require('babel-core').transform('code', {
  optional: ['es7.decorators'],
  plugins: ['auto-assign']
});
```

## License

ISC
<commit_msg>Link to the new plugin by @jakewhelan<commit_after># [DEPRECATED] babel-plugin-auto-assign

[![npm version](https://img.shields.io/npm/v/babel-plugin-auto-assign.svg)](https://www.npmjs.org/package/babel-plugin-auto-assign)
[![npm downloads](https://img.shields.io/npm/dm/babel-plugin-auto-assign.svg)](https://www.npmjs.org/package/babel-plugin-auto-assign)

**This plugin is no longer maintained, and works only with Babel v5. To use the feature in newer versions of Babel, please check out [jakewhelan/babel-plugin-transform-constructor-self-assign](https://github.com/jakewhelan/babel-plugin-transform-constructor-self-assign)**

---

A babel plugin that automatically assigns constructor parameters to instance properties. Might be convenient for class-based DI like Angular does.

Before:

```js
@autoAssign
class Hello {
  constructor(foo, bar, baz) {
  }
}
```

After:

```js
class Hello {
  constructor(foo, bar, baz) {
    this.foo = foo;
    this.bar = bar;
    this.baz = baz;
  }
}
```

## Installation

```sh
$ npm install babel-plugin-auto-assign
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "optional": ["es7.decorators"],
  "plugins": ["auto-assign"]
}
```

### Via CLI

```sh
$ babel --optional es7.decorators --plugins auto-assgin script.js
```

### Via Node API

```js
require('babel-core').transform('code', {
  optional: ['es7.decorators'],
  plugins: ['auto-assign']
});
```

## License

ISC

{'fraction_non_alphanumeric': 0.18337218337218336, 'fraction_numerical': 0.0027195027195027195, 'mean_word_length': 4.109126984126984, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 9, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7260916', 'n_tokens_mistral': 968, 'n_tokens_neox': 879, 'n_words': 196}