mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix lang preferences when changed lang list
This commit is contained in:
1 parent
391eb96b22
commit
e7780c56bb
7 files changed
+29
-40
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { inspect } from 'util';
|
||||
import * as yaml from 'js-yaml';
|
||||
import * as judge from './judge';
|
||||
import { ValidationError } from '../error';
|
||||
import * as check from '../check';
|
||||
@@ -28,6 +29,13 @@ function set(key: string, value: any) {
|
||||
if (!Number.isSafeInteger(+value)) throw new ValidationError(key);
|
||||
return +value;
|
||||
}
|
||||
if (s.subType === 'yaml') {
|
||||
try {
|
||||
yaml.load(value);
|
||||
} catch (e) {
|
||||
throw new ValidationError(key);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return undefined;
|
||||
|
||||
Reference in new issue
Block a user