Home / File/ parser.ts — ui Source File

parser.ts — ui Source File

Architecture documentation for parser.ts, a typescript file in the ui codebase. 0 imports, 1 dependents.

Entity Profile

Dependency Diagram

graph LR
  653618de_8a1a_fdc1_3a0b_e1c479d72984["parser.ts"]
  1a2f6559_b009_3e8e_9e06_bd17b668e76b["parser.test.ts"]
  1a2f6559_b009_3e8e_9e06_bd17b668e76b --> 653618de_8a1a_fdc1_3a0b_e1c479d72984
  style 653618de_8a1a_fdc1_3a0b_e1c479d72984 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// Valid registry name pattern: @namespace where namespace is alphanumeric with hyphens/underscores
const REGISTRY_PATTERN = /^(@[a-zA-Z0-9](?:[a-zA-Z0-9-_]*[a-zA-Z0-9])?)\/(.+)$/

export function parseRegistryAndItemFromString(name: string) {
  if (!name.startsWith("@")) {
    return {
      registry: null,
      item: name,
    }
  }

  const match = name.match(REGISTRY_PATTERN)
  if (match) {
    return {
      registry: match[1],
      item: match[2],
    }
  }

  return {
    registry: null,
    item: name,
  }
}

Subdomains

Frequently Asked Questions

What does parser.ts do?
parser.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, SchemaValidation subdomain.
What functions are defined in parser.ts?
parser.ts defines 1 function(s): parseRegistryAndItemFromString.
What files import parser.ts?
parser.ts is imported by 1 file(s): parser.test.ts.
Where is parser.ts in the architecture?
parser.ts is located at packages/shadcn/src/registry/parser.ts (domain: FrameworkTooling, subdomain: SchemaValidation, directory: packages/shadcn/src/registry).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free