MCPcopy Create free account
hub / github.com/better-auth/examples / normalizeFormPath

Function normalizeFormPath

nuxt-example/components/ui/auto-form/utils.ts:101–116  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

99 * Constructs a path with dot paths for arrays to use brackets to be compatible with vee-validate path syntax
100 */
101export function normalizeFormPath(path: string): string {
102 const pathArr = path.split(".");
103 if (!pathArr.length) return "";
104
105 let fullPath = String(pathArr[0]);
106 for (let i = 1; i < pathArr.length; i++) {
107 if (isIndex(pathArr[i])) {
108 fullPath += `[${pathArr[i]}]`;
109 continue;
110 }
111
112 fullPath += `.${pathArr[i]}`;
113 }
114
115 return fullPath;
116}
117
118type NestedRecord = Record<string, unknown> | { [k: string]: NestedRecord };
119/**

Callers

nothing calls this directly

Calls 1

isIndexFunction · 0.85

Tested by

no test coverage detected