0.0.2 • Published 9 years ago

babel-plugin-wpm v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

babel-plugin-wpm

Some specific transformer(s) for Web Package Manager

Input

Class({
  IndexRoute() {
  },

  signin() {
  }
});

Output

Class({
  constructor: function IndexRoute() {
  },

  signin: function signin() {
  }
});

Rules

  • If there is only one CamelCase method. The method becomes constructor.
  • If there are more than one CamelCase methods, the first CamelCase method becomes constructor.

Installation

$ npm install babel-plugin-wpm

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["babel-plugin-wpm"]
}

Via CLI

$ babel --plugins babel-plugin-wpm script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["babel-plugin-wpm"]
});