mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: add Types.Set
This commit is contained in:
1 parent
43d721b630
commit
c9fdd26504
3 files changed
+15
-6
No files matched your search
@@ -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],
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user