Skip to content

Commit f9fedb3

Browse files
committed
fix: inline transform key function
1 parent 1c7e79c commit f9fedb3

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

src/lib/index.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<script lang="ts">
22
import type { SvelteSeo } from './types';
3-
import transformKey from "../utils/transform-key";
43
import OpenGraphComponent from "./open-graph.svelte";
54
5+
// Helper function to change eg, twitter.title into twitter:title
6+
function transformKey(key: string): string {
7+
return key.replace(/([a-z])([A-Z])/g, "$1:$2").toLowerCase();
8+
}
9+
610
interface Props extends SvelteSeo {}
711
812
const {

src/lib/open-graph.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<script lang="ts">
22
import type { OpenGraph as OpenGraphType } from './types';
3-
import transformKey from "../utils/transform-key";
3+
4+
// Helper function to change eg, twitter.title into twitter:title
5+
function transformKey(key: string): string {
6+
return key.replace(/([a-z])([A-Z])/g, "$1:$2").toLowerCase();
7+
}
48
59
interface Props {
610
openGraph: OpenGraphType;

src/utils/transform-key.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/utils/transform-key.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)