mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: NumericArray: support comma sep (#477)
This commit is contained in:
1 parent
cf99d58220
commit
e365c3ccd6
1 file changed
+3
-3
@@ -124,10 +124,10 @@ export const Types: Types = {
|
||||
}, null],
|
||||
NumericArray: [(v) => {
|
||||
if (v instanceof Array) return v.map(Number);
|
||||
return v ? [Number(v)] : [];
|
||||
return v.split(',').map(Number);
|
||||
}, (v) => {
|
||||
if (v instanceof Array) return !v.map(Number).includes(NaN);
|
||||
return !Number.isNaN(+v);
|
||||
if (v instanceof Array) return v.map(Number).every(Number.isSafeInteger);
|
||||
return v.split(',').map(Number).every(Number.isSafeInteger);
|
||||
}],
|
||||
CommaSeperatedArray: [
|
||||
(v) => v.toString().replace(/,/g, ',').split(',').map((e) => e.trim()).filter((i) => i),
|
||||
|
||||
Reference in new issue
Block a user