MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / modifyObject

Function modifyObject

framework/utils/lib/common.ts:127–135  ·  view source on GitHub ↗
(source: T)

Source from the content-addressed store, hash-verified

125
126function deepen(modifyString: (source: string) => string) {
127 function modifyObject<T>(source: T): T {
128 if (typeof source !== 'object' || !source) return source;
129 if (Array.isArray(source)) return source.map(modifyObject) as any;
130 const result = {} as any;
131 for (const key in source) {
132 result[modifyString(key)] = modifyObject(source[key]);
133 }
134 return result as T;
135 }
136
137 return function t<T>(source: T): T {
138 if (typeof source === 'string') return modifyString(source) as any;

Callers 1

deepenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected