protocol-buffers
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -36,2 +36,20 @@ var os = require('os') | ||
function stringifyEnum (map, spaces) { | ||
const keys = Object.keys(map) | ||
const safe = keys.every(function (k) { | ||
if (typeof map[k] !== 'number') return false | ||
return /^[a-z][a-z0-9]+$/i.test(k) | ||
}) | ||
if (!safe) return JSON.stringify(map, null, 2).replace(/\n/g, os.EOL) + os.EOL | ||
var out = '{' + os.EOL | ||
keys.forEach(function (k, i) { | ||
out += spaces + ' ' + k + ': ' + map[k] + (i < keys.length - 1 ? ',' : '') + os.EOL | ||
}) | ||
return out + spaces + '}' + os.EOL | ||
} | ||
function visit (messages, exports, spaces) { | ||
@@ -50,3 +68,3 @@ var encoders = Object.keys(messages).filter(function (name) { | ||
out += spaces + exports + '.' + name + ' = ' + | ||
JSON.stringify(messages[name], null, 2).replace(/\n/g, os.EOL) + os.EOL + os.EOL | ||
stringifyEnum(messages[name], spaces) + os.EOL | ||
}) | ||
@@ -53,0 +71,0 @@ |
{ | ||
"name": "protocol-buffers", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "Protocol Buffers for Node.js", | ||
@@ -5,0 +5,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
43875
1212