{"id":26265850,"url":"https://github.com/proxima812/astro-ts-mastery","last_synced_at":"2026-04-29T10:01:59.180Z","repository":{"id":206512670,"uuid":"717003037","full_name":"proxima812/Astro-ts-mastery","owner":"proxima812","description":"🚀 utils and libs for Astro.js projects.","archived":false,"fork":false,"pushed_at":"2023-11-10T14:37:08.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T03:46:08.091Z","etag":null,"topics":["astro-content","astro-js","en","getcollection","js","ru","slug","slugify","ts","zod"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proxima812.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-10T10:38:17.000Z","updated_at":"2024-12-12T17:04:55.000Z","dependencies_parsed_at":"2023-11-10T15:53:39.992Z","dependency_job_id":null,"html_url":"https://github.com/proxima812/Astro-ts-mastery","commit_stats":null,"previous_names":["proxima812/astro-ts-mastery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/proxima812/Astro-ts-mastery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxima812%2FAstro-ts-mastery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxima812%2FAstro-ts-mastery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxima812%2FAstro-ts-mastery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxima812%2FAstro-ts-mastery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proxima812","download_url":"https://codeload.github.com/proxima812/Astro-ts-mastery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proxima812%2FAstro-ts-mastery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro-content","astro-js","en","getcollection","js","ru","slug","slugify","ts","zod"],"created_at":"2025-03-14T03:15:40.063Z","updated_at":"2026-04-29T10:01:59.174Z","avatar_url":"https://github.com/proxima812.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"import { getCollection, type CollectionEntry } from \"astro:content\";\nimport GithubSlugger from \"github-slugger\";\nimport slugify from \"slugify\";\nimport { marked } from \"marked\";\n\n/* --------------------------------- slug --------------------------------- */\n\nconst RU_REGEX = /[а-яё]/i;\nconst slugger = new GithubSlugger();\n\nexport const customSlugify = (value = \"\"): string =\u003e {\n  if (!value) return \"\";\n\n  if (RU_REGEX.test(value)) {\n    return slugify(value, {\n      lower: true,\n      strict: true,\n      locale: \"ru\",\n      trim: true,\n    });\n  }\n\n  return slugger.slug(value);\n};\n\n/* ------------------------------ collections ------------------------------ */\n\nexport const getSinglePage = async \u003cT\u003e(\n  collection: string\n): Promise\u003cCollectionEntry\u003cT\u003e[]\u003e =\u003e {\n  const pages = await getCollection(collection);\n\n  return pages.filter(\n    (p) =\u003e !p.data?.draft \u0026\u0026 !p.id.startsWith(\"-\")\n  );\n};\n\nexport const getTaxonomy = async (\n  collection: string,\n  field: string\n): Promise\u003cstring[]\u003e =\u003e {\n  const pages = await getSinglePage\u003cany\u003e(collection);\n\n  return [\n    ...new Set(\n      pages\n        .flatMap((p) =\u003e p.data?.[field] ?? [])\n        .filter(Boolean)\n        .map(customSlugify)\n    ),\n  ];\n};\n\n/* -------------------------------- markdown ------------------------------- */\n\nexport const markdownify = (content = \"\"): string =\u003e {\n  if (!content) return \"\";\n  return marked.parseInline(content);\n};\n\n/* -------------------------------- humanize ------------------------------- */\n\nexport const humanize = (value = \"\"): string =\u003e {\n  if (!value) return \"\";\n\n  const cleaned = value\n    .trim()\n    .replace(/[_\\s]+/g, \" \");\n\n  return cleaned.charAt(0).toUpperCase() + cleaned.slice(1);\n};\n\n/* -------------------------------- plainify ------------------------------- */\n\nexport const plainify = (html = \"\"): string =\u003e {\n  if (!html) return \"\";\n\n  const text = html\n    .replace(/\u003c\\/?[^\u003e]+\u003e/g, \"\")\n    .replace(/\\s+/g, \" \")\n    .trim();\n\n  return decodeHTMLEntities(text);\n};\n\nconst decodeHTMLEntities = (str: string): string =\u003e\n  str.replace(\n    /\u0026(nbsp|amp|lt|gt|quot|#39);/g,\n    (m) =\u003e\n      ({\n        \"\u0026nbsp;\": \" \",\n        \"\u0026amp;\": \"\u0026\",\n        \"\u0026lt;\": \"\u003c\",\n        \"\u0026gt;\": \"\u003e\",\n        \"\u0026quot;\": '\"',\n        \"\u0026#39;\": \"'\",\n      } as Record\u003cstring, string\u003e)[m] ?? m\n  );\n\n/* ------------------------------ reading time ------------------------------ */\n\nconst WORDS_PER_MINUTE = 275;\n\nconst readingTime = (content = \"\", locale: \"en\" | \"ru\" = \"en\"): string =\u003e {\n  if (!content) return \"0 min\";\n\n  const words = content.match(/\\p{L}+/gu)?.length ?? 0;\n  const images = (content.match(/\u003cimg\\b/gi) ?? []).length;\n\n  const imageSeconds = images\n    ? images * 3 + Math.min(images, 10) * 1\n    : 0;\n\n  const minutes = Math.max(\n    1,\n    Math.ceil(words / WORDS_PER_MINUTE + imageSeconds / 60)\n  );\n\n  if (locale === \"ru\") {\n    return `${minutes} мин чтения`;\n  }\n\n  return `${minutes} min read`;\n};\n\nexport default readingTime;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproxima812%2Fastro-ts-mastery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproxima812%2Fastro-ts-mastery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproxima812%2Fastro-ts-mastery/lists"}