Skip to content

Commit 452bbf3

Browse files
authored
refactor(components/code): cleanup
1 parent 02f3f9f commit 452bbf3

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/components/Code.astro

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@ const response = await fetch(
2020
);
2121
2222
const parsed = await response.json();
23-
let version = parsed?.[0]?.["name"] ?? "v8.0.0";
23+
const version = parsed?.[0]?.["name"] ?? "v8.0.0";
2424
2525
const { code, lang, noVersion, ...props } = Astro.props;
26-
27-
if (noVersion)
28-
{
29-
version = version.substring(1);
30-
}
31-
32-
const versionedCode = code.replace("$VERSION$", version);
26+
const versionedCode = code.replace("$VERSION$", noVersion ? version.substring(1) : version);
3327
---
3428

3529
<Default code={versionedCode} lang={lang} {...props}>

0 commit comments

Comments
 (0)