forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.ts
More file actions
20 lines (18 loc) · 415 Bytes
/
theme.ts
File metadata and controls
20 lines (18 loc) · 415 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* 获取主题信息
* @param theme theme 形如 @alife/theme-97 或者 @alife/theme-97@^1.0.0
*/
export interface ThemeInfo {
name: string;
version?: string;
}
export function getThemeInfo(theme: string): ThemeInfo {
const sepIdx = theme.indexOf('@', 1);
if (sepIdx === -1) {
return { name: theme };
}
return {
name: theme.slice(0, sepIdx),
version: theme.slice(sepIdx + 1),
};
}