mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 14:35:38 +02:00
refactor(frontend/aiscript): AiScriptバージョン取得・判定ロジックを統一 (#16845)
* refactor(frontend): AiScriptバージョン取得・判定ロジックを統一 * fix
This commit is contained in:
@@ -6,13 +6,6 @@
|
||||
import { errors, utils } from '@syuilo/aiscript';
|
||||
import type { values } from '@syuilo/aiscript';
|
||||
|
||||
const extractVersionIdentifier = /^\/\/\/\s*@\s*(\d+)\.(\d+)\.\d+$/m;
|
||||
|
||||
export function getAiScriptVersion(script: string): { major: number; minor: number } | undefined {
|
||||
const match = extractVersionIdentifier.exec(script);
|
||||
return match ? { major: Number(match[1]), minor: Number(match[2]) } : undefined;
|
||||
}
|
||||
|
||||
export function assertStringAndIsIn<A extends readonly string[]>(value: values.Value | undefined, expects: A): asserts value is values.VStr & { value: A[number] } {
|
||||
utils.assertString(value);
|
||||
const str = value.value;
|
||||
|
||||
Reference in New Issue
Block a user