{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "truncate-string",
  "type": "registry:lib",
  "title": "Truncate String",
  "description": "Truncate a string to a given length.",
  "files": [
    {
      "path": "registry/default/strings/truncate-string.ts",
      "content": "/**\n * Truncates a string to a given length and appends an ellipsis (\"...\") if necessary.\n *\n * @param str - The input string.\n * @param length - The maximum length of the string.\n * @returns The truncated string with \"...\" if it exceeded the limit.\n *\n * @example\n * truncate(\"Hello TypeScript World\", 10); // \"Hello Type...\"\n */\nexport function truncateString(str: string, length: number): string {\n  return str.length > length ? `${str.slice(0, length)}...` : str;\n}\n",
      "type": "registry:lib"
    }
  ]
}