Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@protobufjs/codegen
Advanced tools
A minimalistic code generation utility.
Weekly downloads
Readme
A minimalistic code generation utility.
codegen([functionParams: string[]
], [functionName: string]): Codegen
Begins generating a function.
codegen.verbose = false
When 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 signCodegen([scope: Object.<string,*>
]): Function
Finishes the function and returns it.
Codegen.toString([functionNameOverride: string
]): string
Returns the function as a string.
var codegen = require("@protobufjs/codegen");
var add = codegen(["a", "b"], "add") // A function with parameters "a" and "b" named "add"
("// awesome comment") // adds the line to the function's body
("return a + b - c + %d", 1) // replaces %d with 1 and adds the line to the body
({ c: 1 }); // adds "c" with a value of 1 to the function's scope
console.log(add.toString()); // function add(a, b) { return a + b - c + 1 }
console.log(add(1, 2)); // calculates 1 + 2 - 1 + 1 = 3
License: BSD 3-Clause License
FAQs
A minimalistic code generation utility.
The npm package @protobufjs/codegen receives a total of 9,012,683 weekly downloads. As such, @protobufjs/codegen popularity was classified as popular.
We found that @protobufjs/codegen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.