Ember/5/Es5 Getter Ember Codemod

1.0.1Last update Jul 24, 2024
by@Codemod
Ember
migration

This codemod transforms get() to getProperties() to use traditional object dot notation. This standard was proposed by Ember.js team in https://github.com/emberjs/rfcs/blob/master/text/0281-es5-getters.md.

Before

let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
chancancode.get('fullName');
let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
model.get('fullName');
let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
route.get('fullName');
let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
controller.get('fullName');
controller.get('foo.bar');
controller.get('foo-bar');

After

let chancancode = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
chancancode.get('fullName');
let model = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
model.get('fullName');
let route = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
route.fullName;
let controller = Person.create({ firstName: 'Godfrey', lastName: 'Chan' });
controller.fullName;
controller.get('foo.bar');
controller['foo-bar'];

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now