Function swc_ecma_transforms_compat::es2015::computed_properties[][src]

pub fn computed_properties() -> impl Fold

@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 = {},
  _defineProperty(_obj, "x" + foo, "heh"),
  _defineProperty(_obj, "y" + bar, "noo"),
  _defineProperty(_obj, "foo", "foo"),
  _defineProperty(_obj, "bar", "bar"),
  _obj
);

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