UNPKG

@shutootaki/gwm

Version:
43 lines 1.21 kB
/** * 設定ファイルパース用の型ガード関数 */ /** * 文字列配列かどうかを判定 */ export function isStringArray(value) { return Array.isArray(value) && value.every((v) => typeof v === 'string'); } /** * virtual_env_handling の mode 値かどうかを判定 */ export function isModeString(value) { return value === 'skip' || value === 'ignore'; } /** * プレーンオブジェクトかどうかを判定 */ export function isPlainObject(value) { return (typeof value === 'object' && value !== null && !Array.isArray(value) && Object.prototype.toString.call(value) === '[object Object]'); } /** * clean_branch の値かどうかを判定 */ export function isCleanBranchMode(value) { return value === 'auto' || value === 'ask' || value === 'never'; } export function isCustomVirtualEnvPattern(value) { if (!isPlainObject(value)) return false; if (typeof value.language !== 'string') return false; if (!isStringArray(value.patterns)) return false; if (value.commands !== undefined && !isStringArray(value.commands)) { return false; } return true; } //# sourceMappingURL=guards.js.map