MCPcopy Create free account
hub / github.com/lingodotdev/lingo.dev / normalizeObjectKeys

Function normalizeObjectKeys

packages/cli/src/cli/loaders/flat.ts:167–185  ·  view source on GitHub ↗
(
  obj: Record<string, any>,
)

Source from the content-addressed store, hash-verified

165}
166
167export function normalizeObjectKeys(
168 obj: Record<string, any>,
169): Record<string, any> {
170 if (_.isObject(obj) && !_.isArray(obj)) {
171 return _.transform(
172 obj,
173 (result, value, key) => {
174 const newKey = `${key}`.replace(OBJECT_NUMERIC_KEY_PREFIX, "");
175 result[newKey] =
176 _.isObject(value) && !_.isDate(value)
177 ? normalizeObjectKeys(value)
178 : value;
179 },
180 {} as Record<string, any>,
181 );
182 } else {
183 return obj;
184 }
185}
186
187function flattenHints(
188 obj: Record<string, any>,

Callers 3

flat.spec.tsFile · 0.90
createDenormalizeLoaderFunction · 0.85
createNormalizeLoaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…