Ember/5/Object New Constructor

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

new EmberObject() is deprecated in Ember.js v3.9 in favor of constructing instances of EmberObject and its subclasses. This codemod replaces all calls to new EmberObject() with EmberObject.create() and adds a constructor function to classes that extend from EmberObject so that the classes no longer extend from EmberObject.

Before

let obj1 = new EmberObject();
let obj2 = new EmberObject({ prop: 'value' });
const Foo = EmberObject.extend();
let foo = new Foo({ bar: 123 });

After

let obj1 = EmberObject.create();
let obj2 = EmberObject.create({ prop: 'value' });
const Foo = EmberObject.extend();
let foo = new Foo({ bar: 123 });

Build custom codemods

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

background illustrationGet Started Now