{"_id":"babel-plugin-transform-function-sent2","_rev":"81767","name":"babel-plugin-transform-function-sent2","description":"Compile the function.sent meta propety to valid ES2015 code","dist-tags":{"latest":"7.0.0-alpha.16","next":"7.0.0-alpha.17"},"maintainers":[{"name":"hzoo","email":""}],"time":{"modified":"2021-06-03T10:26:05.000Z","created":"2017-07-25T21:36:26.757Z","7.0.0-alpha.17":"2017-07-26T12:40:15.881Z","7.0.0-alpha.16":"2017-07-25T21:36:26.757Z"},"users":{},"repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-sent"},"versions":{"7.0.0-alpha.17":{"name":"babel-plugin-transform-function-sent2","version":"7.0.0-alpha.17","description":"Compile the function.sent meta propety to valid ES2015 code","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-sent"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{"babel-helper-wrap-function":"7.0.0-alpha.17","babel-plugin-syntax-function-sent":"7.0.0-alpha.17"},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.17"},"_id":"babel-plugin-transform-function-sent2@7.0.0-alpha.17","scripts":{},"_shasum":"37e737b996dbcef7a09406f2cc3bb6f715f3535b","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"37e737b996dbcef7a09406f2cc3bb6f715f3535b","size":1590,"noattachment":false,"key":"/babel-plugin-transform-function-sent2/-/babel-plugin-transform-function-sent2-7.0.0-alpha.17.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-function-sent2/download/babel-plugin-transform-function-sent2-7.0.0-alpha.17.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-function-sent2-7.0.0-alpha.17.tgz_1501072815004_0.5275427023880184"},"directories":{},"publish_time":1501072815881,"_hasShrinkwrap":false,"_cnpm_publish_time":1501072815881},"7.0.0-alpha.16":{"name":"babel-plugin-transform-function-sent2","version":"7.0.0-alpha.16","description":"Compile the function.sent meta propety to valid ES2015 code","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-function-sent"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{"babel-helper-wrap-function":"7.0.0-alpha.16","babel-plugin-syntax-function-sent":"7.0.0-alpha.16"},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-alpha.16"},"_id":"babel-plugin-transform-function-sent2@7.0.0-alpha.16","scripts":{},"_shasum":"e5ba0a273b2547d46ca1a30b75a1f20e4cff687b","_from":".","_npmVersion":"4.6.1","_nodeVersion":"6.9.0","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"shasum":"e5ba0a273b2547d46ca1a30b75a1f20e4cff687b","size":1589,"noattachment":false,"key":"/babel-plugin-transform-function-sent2/-/babel-plugin-transform-function-sent2-7.0.0-alpha.16.tgz","tarball":"http://registry.cnpm.dingdandao.com/babel-plugin-transform-function-sent2/download/babel-plugin-transform-function-sent2-7.0.0-alpha.16.tgz"},"maintainers":[{"name":"hzoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-function-sent2-7.0.0-alpha.16.tgz_1501018585759_0.1705226011108607"},"directories":{},"publish_time":1501018586757,"_cnpm_publish_time":1501018586757,"_hasShrinkwrap":false}},"readme":"# babel-plugin-transform-function-sent2\n\n> Publishing as 2 until we get the package\n> Compile the `function.sent` meta property, used inside generator functions, to valid ES2015 code.\n\n## Example\n\n```js\nfunction* generator() {\n    console.log(\"Sent\", function.sent);\n    console.log(\"Yield\", yield);\n}\n\nconst iterator = generator();\niterator.next(1); // Logs \"Sent 1\"\niterator.next(2); // Logs \"Yield 2\"\n```\n\nIs compiled roughly to\n\n```js\nlet generator = _skipFirstGeneratorNext(function* () {\n    const _functionSent = yield;\n    console.log(\"Sent\", _functionSent);\n    console.log(\"Yield\", yield);\n});\n\nconst iterator = generator();\niterator.next(1); // Logs \"Sent 1\"\niterator.next(2); // Logs \"Yield 1\"\n```\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-transform-function-sent\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"transform-function-sent\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins transform-function-sent script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-function-sent\"]\n});\n```\n\n## References\n\n* [Proposal](https://github.com/allenwb/ESideas/blob/master/Generator%20metaproperty.md)\n","_attachments":{},"license":"MIT"}