Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F5665604
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
638 B
Referenced Files
None
Subscribers
None
simple-form-field.ts
View Options
import
{
FormDataValue
}
from
"../form-types.js"
;
import
{
Context
}
from
"koa"
;
import
{
predicates
}
from
"@sealcode/ts-predicates"
;
import
{
FieldParseResult
,
FormField
}
from
"./field.js"
;
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
Sat, Jun 7, 23:21 (15 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625635
Default Alt Text
simple-form-field.ts (638 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment