{"name":"babel-plugin-transform-for-of-as-array","version":"1.1.1","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":"92f0a579420ce091a574120ed404ef5dc75ccfed","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.1.1","_npmVersion":"5.5.1","_nodeVersion":"9.1.0","_npmUser":{"name":"jridgewell","email":"justin+npm@ridgewell.name"},"dist":{"integrity":"sha512-eE4hZJhOUKpX0q/X3adR8B4hLox+t8oe4ZqmhANUmv4cds07AbWt6O0rtFXK7PKFPPnW4nz/5mpbkPMkflyGeg==","shasum":"f18fcbcbfa2b8caed1445c3153893d37439a6537","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-for-of-as-array/download/babel-plugin-transform-for-of-as-array-1.1.1.tgz","fileCount":73,"unpackedSize":12391,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDyl5upboxeJxt23O+ruAmrjlKTSTLRJoOSUZoWj3Ko1wIgVSwgUhsJqIrKA1+m5L5TUNv7fUdfTdgcX8ely/XmsgI="}],"size":5048,"noattachment":false,"key":"/babel-plugin-transform-for-of-as-array/-/babel-plugin-transform-for-of-as-array-1.1.1.tgz"},"maintainers":[{"name":"jridgewell","email":"justin+npm@ridgewell.name"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-for-of-as-array_1.1.1_1518070139204_0.17914576324160736"},"_hasShrinkwrap":false,"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":1518070139860,"_cnpm_publish_time":1518070139860,"dist-tags":{"latest":"1.1.1"}}