core: add Types.Set

This commit is contained in:
undefined committed 2021-02-24 12:50:50 +08:00
1 parent 43d721b630
commit c9fdd26504
3 files changed
+15 -6

No files matched your search

+6 -1
View File
@@ -64,6 +64,7 @@ export interface Types {
Time: Type,
Range: (range: Array<string | number> | Dictionary<any>) => Type,
Array: Type,
Set: Type,
}
export const Types: Types = {
@@ -133,7 +134,11 @@ export const Types: Types = {
],
Array: [(v) => {
if (v instanceof Array) return v;
return [v] || [];
return v ? [v] : [];
}, null],
Set: [(v) => {
if (v instanceof Array) return new Set(v);
return v ? new Set([v]) : new Set();
}, null],
};