mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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",
|
"name": "hydrooj",
|
||||||
"version": "2.29.36",
|
"version": "2.29.37",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -83,10 +83,7 @@ export const Types: Types = {
|
|||||||
Int: [(v) => parseInt(v, 10), (v) => isSafeInteger(parseInt(v, 10))],
|
Int: [(v) => parseInt(v, 10), (v) => isSafeInteger(parseInt(v, 10))],
|
||||||
UnsignedInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) >= 0],
|
UnsignedInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) >= 0],
|
||||||
PositiveInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) > 0],
|
PositiveInt: [(v) => parseInt(v, 10), (v) => parseInt(v, 10) > 0],
|
||||||
Float: [(v) => parseFloat(v), (v) => {
|
Float: [(v) => +v, (v) => Number.isFinite(+v)],
|
||||||
const t = parseFloat(v);
|
|
||||||
return t && !Number.isNaN(t) && Number.isFinite(t);
|
|
||||||
}],
|
|
||||||
// eslint-disable-next-line no-shadow
|
// eslint-disable-next-line no-shadow
|
||||||
ObjectID: [(v) => new ObjectID(v), ObjectID.isValid],
|
ObjectID: [(v) => new ObjectID(v), ObjectID.isValid],
|
||||||
Boolean: [(v) => !!v, null, true],
|
Boolean: [(v) => !!v, null, true],
|
||||||
|
|||||||
Reference in new issue
Block a user