{"name":"babel-plugin-transform-for-of-as-array","version":"1.0.4","description":"Transform all for-of loops into the equivalent array for loop","repository":{"type":"git","url":"git+https://github.com/jridgewell/babel-plugin-transform-for-of-as-array.git"},"author":{"name":"Justin Ridgewell","email":"justin+github@ridgewell.name"},"main":"lib/index.js","license":"MIT","devDependencies":{"babel-cli":"^7.0.0-beta.2","babel-plugin-transform-es2015-modules-amd":"^7.0.0-beta.2","babel-plugin-transform-es2015-modules-commonjs":"^7.0.0-beta.2","babel-preset-env":"^2.0.0-beta.2","mocha":"^2.2.5"},"scripts":{"clean":"rm -rf lib","build":"babel src -d lib","test":"mocha --compilers js:babel-register","test:watch":"npm run test -- --watch","prepublish":"npm run clean && npm run build"},"keywords":["for","of","loop","array","babel-plugin"],"gitHead":"bbaae4a2767655bce7b3e91bd75b2d7904bb97b9","bugs":{"url":"https://github.com/jridgewell/babel-plugin-transform-for-of-as-array/issues"},"homepage":"https://github.com/jridgewell/babel-plugin-transform-for-of-as-array#readme","_id":"babel-plugin-transform-for-of-as-array@1.0.4","_npmVersion":"5.3.0","_nodeVersion":"8.0.0","_npmUser":{"name":"jridgewell","email":"justin+npm@ridgewell.name"},"dist":{"integrity":"sha512-Uvej8S/SmRZNn/d8arh7LECAWo+S0GMvNgd1wxJxLeujT7BmViOyhNFp93a+gHY1/90IYXgdgzV/J1djJpiIWg==","shasum":"05f04e8c2bf22f767f9c552e561d634fb18f35eb","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-for-of-as-array/download/babel-plugin-transform-for-of-as-array-1.0.4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFypahZDX3Z9JzjUpUJzv/Szc0UE4aZLBYIT+kgKqgDRAiB7MVf6v/tU+vuCckGE5AX6y1Tcw6jV4Z15td/AzM3T1Q=="}],"size":3831,"noattachment":false,"key":"/babel-plugin-transform-for-of-as-array/-/babel-plugin-transform-for-of-as-array-1.0.4.tgz"},"maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-for-of-as-array-1.0.4.tgz_1508111140304_0.0778831378556788"},"directories":{},"readme":"# babel-plugin-transform-for-of-as-array\n\nTransform all for-of loops into the equivalent array for loop\n\n## Example\n\n**In**\n\n```js\nconst array = [1, 2, 3];\nfor (const elm of array) {\n  console.log(elm);\n}\n\nlet item;\nfor ({ item } of array.map(item => ({ item }))) {\n  console.log(item);\n}\n```\n\n**Out**\n\n```js\nconst array = [1, 2, 3];\n\nfor (let _i = 0, _length = array.length; _i < _length; _i++) {\n  const elm = array[_i];\n  console.log(elm);\n}\n\nlet item;\nfor (let _i2 = 0, _array$map = array.map(item => ({ item })), _length2 = _array$map.length; _i2 < _length2; _i2++) {\n  ({ item } = _array$map[_i2]);\n\n  console.log(item);\n}\n```\n\n\n## `loose` transformation\n\nIn addition to the normal transform, we also support a null-ish checking `loose` transform. Passing `{ loose: true }` option into the plugin enables it:\n\n**In**\n\n```js\nconst array = null;\nfor (const elm of array) {\n  console.log(elm);\n}\n\nlet item;\nfor ({ item } of array.map(item => ({ item }))) {\n  console.log(item);\n}\n```\n\n**Out**\n\n```js\nconst array = null;\n\nfor (let _i = 0, _length = array == null ? 0 : array.length; _i < _length; _i++) {\n  const elm = array[_i];\n  console.log(elm);\n}\n\nlet item;\nfor (let _i2 = 0, _array$map = array.map(item => ({ item })), _length2 = _array$map == null ? 0 : _array$map.length; _i2 < _length2; _i2++) {\n  ({ item } = _array$map[_i2]);\n\n  console.log(item);\n}\n```\n\n\n## Installation\n\n```sh\n$ npm install babel-plugin-transform-for-of-as-array\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"transform-for-of-as-array\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins transform-for-of-as-array script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-for-of-as-array\"]\n});\n```\n","publish_time":1508111141244,"_cnpm_publish_time":1508111141244,"dist-tags":{"latest":"1.1.1"}}