{"name":"@protobufjs/codegen","description":"A minimalistic code generation utility.","version":"2.0.3","author":{"name":"Daniel Wirtz","email":"dcode+protobufjs@dcode.io"},"repository":{"type":"git","url":"git+https://github.com/dcodeIO/protobuf.js.git"},"license":"BSD-3-Clause","main":"index.js","types":"index.d.ts","bugs":{"url":"https://github.com/dcodeIO/protobuf.js/issues"},"homepage":"https://github.com/dcodeIO/protobuf.js#readme","_id":"@protobufjs/codegen@2.0.3","scripts":{},"_shasum":"b0b8304056e0066c055019f559e1283158fa67fc","_from":".","_npmVersion":"4.0.5","_nodeVersion":"6.9.1","_npmUser":{"name":"dcode","email":"dcode+npm@dcode.io"},"dist":{"shasum":"b0b8304056e0066c055019f559e1283158fa67fc","tarball":"http://registry-npm.ywwl.com/@protobufjs/codegen/download/@protobufjs/codegen-2.0.3.tgz","integrity":"sha512-NGWvzOihh8cBJo8cFL1R+B2V/iEvb+M03GDJT/b/6o9xpZcP2/ilfdb0UHuU3NC3TPbD4Oblq89mMpCRTv1tlA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICxqd8z5BHwOqTsbgaI3/lfifenmcCdGY5gP06ZFKO+ZAiEA2wBoKqcKnsQRc0umrVcC4pTeu4HZfDeS9UKHOq4S1GU="}],"size":3402,"noattachment":false,"key":"/@protobufjs/codegen/-/@protobufjs/codegen-2.0.3.tgz"},"maintainers":[{"name":"dcode","email":"dcode@dcode.io"},{"name":"protobufjs","email":"dcode+npm-protobufjs@dcode.io"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/codegen-2.0.3.tgz_1492986128674_0.5484944195486605"},"directories":{},"readme":"@protobufjs/codegen\r\n===================\r\n[![npm](https://img.shields.io/npm/v/@protobufjs/codegen.svg)](https://www.npmjs.com/package/@protobufjs/codegen)\r\n\r\nA minimalistic code generation utility.\r\n\r\nAPI\r\n---\r\n\r\n* **codegen([functionParams: `string[]`], [functionName: string]): `Codegen`**<br />\r\n  Begins generating a function.\r\n\r\n* **codegen.verbose = `false`**<br />\r\n  When set to true, codegen will log generated code to console. Useful for debugging.\r\n\r\nInvoking **codegen** returns an appender function that appends code to the function's body and returns itself:\r\n\r\n* **Codegen(formatString: `string`, [...formatParams: `any`]): Codegen**<br />\r\n  Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters:\r\n\r\n  * `%d`: Number (integer or floating point value)\r\n  * `%f`: Floating point value\r\n  * `%i`: Integer value\r\n  * `%j`: JSON.stringify'ed value\r\n  * `%s`: String value\r\n  * `%%`: Percent sign<br />\r\n\r\n* **Codegen([scope: `Object.<string,*>`]): `Function`**<br />\r\n  Finishes the function and returns it.\r\n\r\n* **Codegen.toString([functionNameOverride: `string`]): `string`**<br />\r\n  Returns the function as a string.\r\n\r\nExample\r\n-------\r\n\r\n```js\r\nvar codegen = require(\"@protobufjs/codegen\");\r\n\r\nvar add = codegen([\"a\", \"b\"], \"add\") // A function with parameters \"a\" and \"b\" named \"add\"\r\n  (\"// awesome comment\")             // adds the line to the function's body\r\n  (\"return a + b - c + %d\", 1)       // replaces %d with 1 and adds the line to the body\r\n  ({ c: 1 });                        // adds \"c\" with a value of 1 to the function's scope\r\n\r\nconsole.log(add.toString()); // function add(a, b) { return a + b - c + 1 }\r\nconsole.log(add(1, 2));      // calculates 1 + 2 - 1 + 1 = 3\r\n```\r\n\r\n**License:** [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause)\r\n","publish_time":1492986129282,"_cnpm_publish_time":1492986129282,"dist-tags":{"latest":"2.0.5"}}