MCPcopy Create free account
hub / github.com/di-sukharev/opencommit / camelCaseKeys

Function camelCaseKeys

out/cli.cjs:77624–77640  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

77622function wrapError(f4, message) {
77623 try {
77624 const result = f4();
77625 return result;
77626 } catch (cause) {
77627 throw new Error(`${message}: ${cause}`, { cause });
77628 }
77629}
77630function camelCaseKeys(obj) {
77631 if (typeof obj !== "object" || !obj)
77632 return obj;
77633 if (Array.isArray(obj)) {
77634 return obj.map((v5) => camelCaseKeys(v5));
77635 } else {
77636 for (const key of Object.keys(obj)) {
77637 const value = obj[key];
77638 const newKey = tocamelCase(key);
77639 if (newKey !== key) {
77640 delete obj[key];
77641 }
77642 obj[newKey] = typeof obj[newKey] === "object" ? camelCaseKeys(value) : value;
77643 }

Calls 2

tocamelCaseFunction · 0.85
keysMethod · 0.45

Tested by

no test coverage detected