Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7317621
float.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
678 B
Referenced Files
None
Subscribers
None
float.ts
View Options
import
{
Field
}
from
"../../../main"
;
/** Stores a floating point number. DOes not take params. Does not allow range filtering. @todo: add range filtering */
export
default
class
Float
extends
Field
{
typeName
=
"float"
;
async
isProperValue
(
_
:
any
,
input
:
number
)
{
const
test
=
parseFloat
(
input
.
toString
());
if
(
test
===
null
||
isNaN
(
test
)
||
isNaN
(
input
)
===
true
)
{
return
Field
.
invalid
(
`Value '
${
input
}
' is not a float number format.`
);
}
else
{
return
Field
.
valid
();
}
}
async
encode
(
_
:
any
,
value
:
number
|
string
)
{
if
(
value
===
null
)
{
return
null
;
}
const
parsed_float
=
parseFloat
(
value
.
toString
());
return
parsed_float
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Jul 13, 04:52 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
821786
Default Alt Text
float.ts (678 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment