pub fn computed_properties(c: Config) -> impl Fold
Expand description

@babel/plugin-transform-computed-properties

§Example

§In

var obj = {
  ["x" + foo]: "heh",
  ["y" + bar]: "noo",
  foo: "foo",
  bar: "bar"
};

§Out

var _obj;

var obj = (
  _obj = {},
  _define_property(_obj, "x" + foo, "heh"),
  _define_property(_obj, "y" + bar, "noo"),
  _define_property(_obj, "foo", "foo"),
  _define_property(_obj, "bar", "bar"),
  _obj
);

TODO(kdy1): cache reference like (_f = f, mutatorMap[_f].get = function(){}) instead of (mutatorMap[f].get = function(){}