diff --git a/packages/runtime/src/util-methods.ts b/packages/runtime/src/util-methods.ts index bed94722..0c93254a 100644 --- a/packages/runtime/src/util-methods.ts +++ b/packages/runtime/src/util-methods.ts @@ -1,4 +1,3 @@ -import { Version } from '../../core/typings/version'; import { apiService } from './api-service'; export function mountUtilMethods() { @@ -16,20 +15,3 @@ export function mountUtilMethods() { } }); } - -// parse component Type -export function parseType(v: string) { - const TYPE_REG = /^([a-zA-Z0-9_\d]+\/[a-zA-Z0-9_\d]+)\/([a-zA-Z0-9_\d]+)$/; - function isValidType(v: string): boolean { - return TYPE_REG.test(v); - } - if (!isValidType(v)) { - throw new Error(`Invalid type string: "${v}"`); - } - - const [, version, name] = v.match(TYPE_REG)!; - return { - version, - name, - }; -} diff --git a/packages/runtime/src/utils/parseType.ts b/packages/runtime/src/utils/parseType.ts new file mode 100644 index 00000000..324b5e24 --- /dev/null +++ b/packages/runtime/src/utils/parseType.ts @@ -0,0 +1,16 @@ +// parse component Type +export function parseType(v: string) { + const TYPE_REG = /^([a-zA-Z0-9_\d]+\/[a-zA-Z0-9_\d]+)\/([a-zA-Z0-9_\d]+)$/; + function isValidType(v: string): boolean { + return TYPE_REG.test(v); + } + if (!isValidType(v)) { + throw new Error(`Invalid type string: "${v}"`); + } + + const [, version, name] = v.match(TYPE_REG)!; + return { + version, + name, + }; +}