{"name":"babel-template","version":"6.0.2","description":"","author":{"name":"Sebastian McKenzie","email":"sebmck@gmail.com"},"homepage":"https://babeljs.io/","license":"MIT","repository":{"type":"git","url":"git+https://github.com/babel/babel.git"},"main":"lib/index.js","dependencies":{"babylon":"^6.0.2","babel-traverse":"^6.0.2","babel-types":"^6.0.2","babel-runtime":"^6.0.2","lodash":"^3.10.1"},"bugs":{"url":"https://github.com/babel/babel/issues"},"_id":"babel-template@6.0.2","scripts":{},"_shasum":"d5a9bef2b33616dd2f08452287d1cab64b1373d0","_from":".","_npmVersion":"2.14.3","_nodeVersion":"4.1.0","_npmUser":{"name":"sebmck","email":"sebmck@gmail.com"},"dist":{"shasum":"d5a9bef2b33616dd2f08452287d1cab64b1373d0","tarball":"http://registry-npm.ywwl.com/babel-template/download/babel-template-6.0.2.tgz","integrity":"sha512-ePt81ZUUCQehHNCGJBZSSHkcJFsI+46M94jOvRYURP/JPkB/eGe2Vo2N8G8+hG3btqcK73tEawSKbBrxoqzTxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH1O8f9bRrvT+/3/T691bAEguDumomkzTos36Rcr2rLgAiEAm1IAHdSqGSA6ivTRju7kIk3oDEmrfL0UQL3NbT7QKbk="}],"size":2173,"noattachment":false,"key":"/babel-template/-/babel-template-6.0.2.tgz"},"maintainers":[{"name":"sebmck","email":"sebmck@gmail.com"}],"directories":{},"readme":"# babel-template\n\n> Generate an AST from a string template.\n\nIn computer science, this is known as an implementation of quasiquotes.\n\n## Install\n\n```sh\nnpm install --save-dev babel-template\n```\n\n## Usage\n\n```js\nimport template from \"babel-template\";\nimport generate from \"babel-generator\";\nimport * as t from \"babel-types\";\n\nconst buildRequire = template(`\n  var IMPORT_NAME = require(SOURCE);\n`);\n\nconst ast = buildRequire({\n  IMPORT_NAME: t.identifier(\"myModule\"),\n  SOURCE: t.stringLiteral(\"my-module\")\n});\n\nconsole.log(generate(ast).code);\n```\n\n```js\nconst myModule = require(\"my-module\");\n```\n\n## API\n\n### `template(code, [opts])`\n\n#### code\n\nType: `string`\n\n#### options\n\n`babel-template` accepts all of the options from [babylon], and specifies\nsome defaults of its own:\n\n* `allowReturnOutsideFunction` is set to `true` by default.\n* `allowSuperOutsideMethod` is set to `true` by default.\n\n##### preserveComments\n\nType: `boolean`\nDefault: `false`\n\nSet this to `true` to preserve any comments from the `code` parameter.\n\n#### Return value\n\n`babel-template` returns a `function` which is invoked with an optional object\nof replacements. See the usage section for an example.\n\n[babylon]: https://github.com/babel/babylon#options\n","publish_time":1446142941286,"_cnpm_publish_time":1446142941286,"dist-tags":{"latest":"6.26.0","next":"7.0.0-beta.3"}}