Skip to content

Commit

Permalink
try cp-property-map codemod from ember-3x-codemods (#727)
Browse files Browse the repository at this point in the history
* [FEAT] Add computed-property property() Modifier codemod
  • Loading branch information
rajasegar authored and Kelly Selden committed Oct 23, 2019
1 parent ba9d969 commit 6d79ffd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Controller.extend({
fullName: computed('firstName', 'lastName', function() {
Expand All @@ -11,6 +12,10 @@ export default Controller.extend({
return `${this.firstName} ${this.lastName}`;
},

friendNames: map('friends', ['nameKey'], function(friend) {
return friend[this.nameKey];
}),

actions: {
foo(object) {
this.doStuff(object);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Ember from 'ember';
import { merge } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Ember.Controller.extend({
fullName: computed(function() {
Expand All @@ -10,6 +11,10 @@ export default Ember.Controller.extend({
return `${this.firstName} ${this.lastName}`;
}).volatile('firstName', 'lastName'),

friendNames: map('friends', function(friend) {
return friend[this.nameKey];
}).property('nameKey'),

actions: {
foo(object) {
Ember.propertyWillChange(object, 'someProperty');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Controller from '@ember/controller';
import Ember from 'ember';
import { assign } from '@ember/polyfills';
import { map } from '@ember/object/computed';

export default Controller.extend({
fullName: computed('firstName', 'lastName', function() {
Expand All @@ -11,6 +12,10 @@ export default Controller.extend({
return `${this.firstName} ${this.lastName}`;
},

friendNames: map('friends', ['nameKey'], function(friend) {
return friend[this.nameKey];
}),

actions: {
foo(object) {
this.doStuff(object);
Expand Down

0 comments on commit 6d79ffd

Please sign in to comment.