init: initial commit

This commit is contained in:
2026-10-07 09:28:43 +08:00
commit a68a4ef411
251 changed files with 38279 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
function camelName(key) { return key.replace(/_([a-z0-9])/g, function(_, c) { return c.toUpperCase(); }); }
function snakeName(key) { return key.replace(/[A-Z]/g, function(c) { return '_' + c.toLowerCase(); }); }
function mapKeys(value, name) {
if (Array.isArray(value)) return value.map(function(v) { return mapKeys(v, name); });
if (value && typeof value === 'object') { var out = {}; Object.keys(value).forEach(function(key) { out[name(key)] = mapKeys(value[key], name); }); return out; }
return value;
}
module.exports = { camelName, toWire: function(v) { return mapKeys(v, camelName); }, fromWire: function(v) { return mapKeys(v, snakeName); } };