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

Function getIndexIfArray

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

Source from the content-addressed store, hash-verified

23 * @returns index or undefined
24 */
25export function getIndexIfArray(string: string) {
26 const indexRegex = /\[(\d+)\]/;
27 // Match the index
28 const match = string.match(indexRegex);
29 // Extract the index (number)
30 const index = match ? Number.parseInt(match[1]) : undefined;
31 return index;
32}
33
34/**
35 * Get the lowest level Zod type.

Callers 1

getSourceValueFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected