jna
jna

Reputation: 996

WebStorm - Object structure refactoring

In WebStorm, I would really like to know if there's a way to refactor the structure of objects.

Let's say I have this object,

inventory = {
  fruits: [
    {type: 'apple', quantity: 24},
    {type: 'orange', quantity: 12}
  ] 
}

which is being used in a for loop further down the file/class

for (const fruit of this.inventory.fruits) { ... }

Now, if I want to change it to

inventory = {
  edibles: {
    fruits: [
      {type: 'apple', quantity: 24},
      {type: 'orange', quantity: 12}
    ]
  } 
}

and

for (const fruit of this.inventory.edibles.fruits) { ... }

Does anyone know if this is possible to achieve with WebStorm refactoring? Or with any JetBrains IDE for that matter.

Thanks

Upvotes: 0

Views: 110

Answers (0)

Related Questions