1.0.1 • Published 5 years ago

babel-plugin-ember-property-computed v1.0.1

Weekly downloads
11
License
-
Repository
github
Last release
5 years ago

babel-plugin-ember-property-computed

Migrate from function prototype fn.property(args) into Ember.computed(args, fn).

Convert computed properties into Ember.computed() to not use prototype anymore. This plugin can be used along with Webpack and other babel plugins just to test in dev server. If you want to overwrite existing files, you can execute this plugin in Node env as well.

Example

In

fullname: function () {
  return `${this.firstName} ${this.lastName}`;
}.property("firstName", "lastName")

Out

fullname: Ember.computed("firstName", "lastName", function () {
  return `${this.firstName} ${this.lastName}`;
})

Installation

$ npm install babel-plugin-ember-property-computed

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["ember-property-computed"]
}

Via CLI

$ babel --plugins ember-property-computed script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["ember-property-computed"]
});