@protobufjs/codegen
A minimalistic code generation utility.
API
codegen([functionParams:
string[]], [functionName: string]):CodegenBegins generating a function.codegen.verbose =
falseWhen set to true, codegen will log generated code to console. Useful for debugging.
Invoking codegen returns an appender function that appends code to the function's body and returns itself:
Codegen(formatString:
string, [...formatParams:any]): Codegen Appends code to the function's body. The format string can contain placeholders specifying the types of inserted format parameters:%d: Number (integer or floating point value)%f: Floating point value%i: Integer value%j: JSON.stringify'ed value%s: String value%%: Percent sign
Codegen([scope:
Object.<string,*>]):FunctionFinishes the function and returns it.Codegen.toString([functionNameOverride:
string]):stringReturns the function as a string.
Example
License: BSD 3-Clause License
Last updated