We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa0911d commit 44adf7cCopy full SHA for 44adf7c
src/normalize.ts
@@ -1,3 +1,5 @@
1
+import assert from 'node:assert'
2
+
3
/**
4
* Lower first letter of the string.
5
*/
@@ -49,7 +51,7 @@ function _lowerCamelCase(name: string) {
49
51
* @param obj object to traverse
50
52
* @param fn function to apply
53
-export function morph(
54
+function morph(
55
obj: any,
56
fn: (key: string, value: any) => { key: string; value: any }
57
) {
@@ -60,6 +62,8 @@ export function morph(
60
62
}
61
63
} else {
64
for (let [key, value] of Object.entries(obj)) {
65
+ // technically this should never happen here, but let's be safe
66
+ assert(typeof key === 'string', 'Only string keys are supported')
67
if (typeof value === 'object') {
68
morph(value, fn)
69
0 commit comments