Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use computed property names as export function name

I know that you can do the following:

let name = 'testFunc'
let functions = {
  [name] () {...}
}

But is it possible to do something like this:

export function [name] () {...}

like image 438
Reath Avatar asked Oct 25 '25 04:10

Reath


1 Answers

Not possible. import, export and module dependencies in general are resolved before runtime. At the time your module is imported from another module, your variable name has no meaning.

like image 190
Saraband Avatar answered Oct 26 '25 17:10

Saraband