You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`toFieldName(pluralTypeName)` - Convert plural PascalCase to singular camelCase field name
92
101
-`toQueryName(singularTypeName)` - Convert singular PascalCase to plural camelCase query name
93
102
103
+
### Deep Object Transformation
104
+
105
+
-`inflektTree(obj, transformer, options?)` - Recursively transform all property names in an object tree
106
+
107
+
## Deep Object Key Transformation
108
+
109
+
The `inflektTree` function recursively transforms all property names in an object tree using any transformer function. This is useful for converting API responses between naming conventions.
110
+
111
+
### Basic Usage
112
+
113
+
```typescript
114
+
// Convert snake_case API response to camelCase for frontend
115
+
const apiResponse = {
116
+
user_name: 'John',
117
+
user_profile: {
118
+
profile_image: 'https://example.com/avatar.jpg',
119
+
account_status: 'active'
120
+
},
121
+
order_items: [
122
+
{ item_id: 1, item_name: 'Product A' },
123
+
{ item_id: 2, item_name: 'Product B' }
124
+
]
125
+
};
126
+
127
+
const result =inflektTree(apiResponse, (key) =>camelize(key, true));
0 commit comments