Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7188607
simple-form-field.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
626 B
Referenced Files
None
Subscribers
None
simple-form-field.ts
View Options
import
{
FieldParseResult
,
FormField
}
from
"./field"
;
import
{
FormDataValue
}
from
"../form"
;
import
{
Context
}
from
"koa"
;
import
{
predicates
}
from
"@sealcode/ts-predicates"
;
export
class
SimpleFormField
<
Required
extends
boolean
>
extends
FormField
<
Required
,
string
|
null
>
{
async
parse
(
_
:
Context
,
raw_value
:
FormDataValue
)
:
Promise
<
FieldParseResult
<
string
>>
{
return
{
parsed_value
:
(
raw_value
||
""
).
toString
(),
parsable
:
true
,
error
:
null
,
};
}
predicate
=
predicates
.
string
;
public
getEmptyValue
()
:
string
{
return
""
;
}
constructor
(
required
:
Required
)
{
super
(
required
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Jul 8, 08:20 (21 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
800852
Default Alt Text
simple-form-field.ts (626 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment