We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 394452a commit af97012Copy full SHA for af97012
packages/common/src/util/splitKey.ts
@@ -1,10 +1,17 @@
1
import type { HatStyleName } from "../ide/types/hatStyles.types";
2
3
-export function splitKey(key: string) {
+interface SplitKey {
4
+ hatStyle: string;
5
+ // If the character is `.` then it will appear as a zero length string
6
+ // due to the way the split on `.` works
7
+ character: HatStyleName;
8
+}
9
+
10
+export function splitKey(key: string): SplitKey {
11
const [hatStyle, character] = key.split(".");
12
13
return {
- hatStyle: hatStyle,
14
+ hatStyle,
15
// If the character is `.` then it will appear as a zero length string
16
// due to the way the split on `.` works
17
character: character.length === 0 ? "." : character,
0 commit comments