{"name":"babel-plugin-transform-es2015-computed-properties","version":"7.0.0-alpha.16","description":"Compile ES2015 computed properties to ES5","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-es2015-computed-properties"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{"babel-template":"7.0.0-alpha.16"},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.16"},"_id":"babel-plugin-transform-es2015-computed-properties@7.0.0-alpha.16","scripts":{},"_shasum":"be54c1ffb3785e8115c635dc0ffc37d6b34c06e7","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"be54c1ffb3785e8115c635dc0ffc37d6b34c06e7","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-es2015-computed-properties/download/babel-plugin-transform-es2015-computed-properties-7.0.0-alpha.16.tgz","integrity":"sha512-eTqoRWajsakf0MgKlhrVO4I835YeKWgPSxK+RdibuScCIg+hg4VPFnbTRxWqNp35C7Zt1d6Zj3furmGbEom+PA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFFagcpV2mJWLcius5KCQfyQEFCCXbXPkjib380otr6bAiBCEQtTDoD7zPSdcIJ2y0BT2MXauTgU6MFtwlf3XQPpJQ=="}],"size":2696,"noattachment":false,"key":"/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-7.0.0-alpha.16.tgz"},"maintainers":[{"email":"sebmck@gmail.com","name":"sebmck"},{"email":"daniel@tschinder.de","name":"danez"},{"email":"hi@henryzoo.com","name":"hzoo"},{"email":"loganfsmyth@gmail.com","name":"loganfsmyth"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-es2015-computed-properties-7.0.0-alpha.16.tgz_1501017493978_0.20717600150965154"},"directories":{},"readme":"# babel-plugin-transform-es2015-computed-properties\n\n> Compile ES2015 computed properties to ES5\n\n## Example\n\n**In**\n\n```js\nvar obj = {\n  [\"x\" + foo]: \"heh\",\n  [\"y\" + bar]: \"noo\",\n  foo: \"foo\",\n  bar: \"bar\"\n};\n```\n\n**Out**\n\n```js\nvar _obj;\n\nfunction _defineProperty(obj, key, value) {\n  if (key in obj) {\n    Object.defineProperty(obj, key, {\n      value: value,\n      enumerable: true,\n      configurable: true,\n      writable: true\n    });\n  } else {\n    obj[key] = value;\n  }\n\n  return obj;\n}\n\nvar obj = (\n  _obj = {},\n  _defineProperty(_obj, \"x\" + foo, \"heh\"),\n  _defineProperty(_obj, \"y\" + bar, \"noo\"),\n  _defineProperty(_obj, \"foo\", \"foo\"),\n  _defineProperty(_obj, \"bar\", \"bar\"),\n  _obj\n);\n```\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-transform-es2015-computed-properties\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\nWithout options:\n\n```json\n{\n  \"plugins\": [\"transform-es2015-computed-properties\"]\n}\n```\n\nWith options:\n\n```json\n{\n  \"plugins\": [\n    [\"transform-es2015-computed-properties\", {\n      \"loose\": true\n    }]\n  ]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins transform-es2015-computed-properties script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-es2015-computed-properties\"]\n});\n```\n\n## Options\n\n### `loose`\n\n`boolean`, defaults to `false`\n\nJust like method assignment in classes, in loose mode, computed property names\nuse simple assignments instead of being defined. This is unlikely to be an issue\nin production code.\n\n#### Example\n\n***In***\n\n```js\nvar obj = {\n  [\"x\" + foo]: \"heh\",\n  [\"y\" + bar]: \"noo\",\n  foo: \"foo\",\n  bar: \"bar\"\n};\n```\n\n***Out***\n\n```js\nvar _obj;\n\nvar obj = (\n  _obj = {},\n  _obj[\"x\" + foo] = \"heh\",\n  _obj[\"y\" + bar] = \"noo\",\n  _obj.foo = \"foo\",\n  _obj.bar = \"bar\",\n  _obj\n);\n```\n","publish_time":1501017494861,"_cnpm_publish_time":1501017494861,"dist-tags":{"latest":"6.24.1","next":"7.0.0-beta.3"}}