We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e157c74 commit 1eddcd9Copy full SHA for 1eddcd9
packages/base/src/utils/setMetaTag.ts
@@ -1,11 +1,8 @@
1
/// <reference lib="dom" />
2
3
+// Courtesy of https://stackoverflow.com/a/67243723.
4
function kebabCase(value: string): string {
- return value
5
- .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/gu, '$1-$2')
6
- .toLowerCase()
7
- .replace(/[^a-z0-9]+/gu, '-')
8
- .replace(/^-+|-+$/gu, '');
+ return value.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());
9
}
10
11
export default function setMetaTag(name: string, content: string): void;
0 commit comments