mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 01:36:08 +08:00
core: parseFloat: allow 0
This commit is contained in:
1 parent
44de90bcab
commit
c67d626abe
2 files changed
+2
-5
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.29.36",
|
||||
"version": "2.29.37",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -83,10 +83,7 @@ export const Types: Types = {
|
||||
Int: [(v) => parseInt(v, 10), (v) => isSafeInteger(parseInt(v, 10))],
|
||||
UnsignedInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) >= 0],
|
||||
PositiveInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) > 0],
|
||||
Float: [(v) => parseFloat(v), (v) => {
|
||||
const t = parseFloat(v);
|
||||
return t && !Number.isNaN(t) && Number.isFinite(t);
|
||||
}],
|
||||
Float: [(v) => +v, (v) => Number.isFinite(+v)],
|
||||
// eslint-disable-next-line no-shadow
|
||||
ObjectID: [(v) => new ObjectID(v), ObjectID.isValid],
|
||||
Boolean: [(v) => !!v, null, true],
|
||||
|
||||
Reference in new issue
Block a user