{"name":"@protobufjs/codegen","description":"A minimalistic code generation utility.","version":"2.0.5","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","gitHead":"082ec3d387ae65ff0fd13f65ca500fd57a3aaff0","_id":"@protobufjs/codegen@2.0.5","bugs":{"url":"https://github.com/dcodeIO/protobuf.js/issues"},"homepage":"https://github.com/dcodeIO/protobuf.js#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-zgXFLzW3Ap33e6d0Wlj4MGIm6Ce8O89n/apUaGNB/jx+hw+ruWEp7EwGUshdLKVRCxZW12fp9r40E1mQrf/34g==","shasum":"d9315ad7cf3f30aac70bda3c068443dc6f143659","tarball":"http://registry-npm.ywwl.com/@protobufjs/codegen/download/@protobufjs/codegen-2.0.5.tgz","fileCount":6,"unpackedSize":9749,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHDlsMgKqgtj3r5c0DID2zpH1gapxP4Lgf7wV/Epc6U2AiB3th34zwqXHdJ7xFp404SS6+uy3Tqe2pfKTfzR34ijiw=="}],"size":3698,"noattachment":false,"key":"/@protobufjs/codegen/-/@protobufjs/codegen-2.0.5.tgz"},"_npmUser":{"name":"dcode","email":"dcode+npm@dcode.io"},"directories":{},"maintainers":[{"name":"dcode","email":"dcode+npm@dcode.io"},{"name":"protobufjs","email":"dcode+protobufjs@dcode.io"},{"name":"google-wombot","email":"node-team-npm+wombot@google.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/codegen_2.0.5_1777321811605_0.6824611587876253"},"_hasShrinkwrap":false,"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":1777321811789,"_cnpm_publish_time":1777321811789,"dist-tags":{"latest":"2.0.5"}}