@protobufjs/codegen
Advanced tools
Comparing version 1.0.6 to 1.0.7
18
index.js
@@ -82,3 +82,3 @@ "use strict"; | ||
function str(name) { | ||
return "function " + (name ? name.replace(/[^\w_$]/g, "_") : "") + "(" + params.join(", ") + ") {\n" + src.join("\n") + "\n}"; | ||
return "function" + (name ? " " + name.replace(/[^\w_$]/g, "_") : "") + "(" + params.join(",") + ") {\n" + src.join("\n") + "\n}"; | ||
} | ||
@@ -125,13 +125,17 @@ | ||
i = 0; | ||
return format.replace(/%([djs])/g, function($0, $1) { | ||
var arg = args[i++]; | ||
format = format.replace(/%([dfjs])/g, function($0, $1) { | ||
switch ($1) { | ||
case "d": | ||
return Math.floor(args[i++]); | ||
case "f": | ||
return Number(args[i++]); | ||
case "j": | ||
return JSON.stringify(arg); | ||
case "d": | ||
return Number(arg); | ||
return JSON.stringify(args[i++]); | ||
default: | ||
return String(arg); | ||
return args[i++]; | ||
} | ||
}); | ||
if (i !== args.length) | ||
throw Error("argument count mismatch"); | ||
return format; | ||
} | ||
@@ -138,0 +142,0 @@ |
{ | ||
"name": "@protobufjs/codegen", | ||
"description": "A closure for generating functions programmatically.", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"author": "Daniel Wirtz <dcode+protobufjs@dcode.io>", | ||
@@ -6,0 +6,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9086
156