Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3011003
remove.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
869 B
Referenced Files
None
Subscribers
None
remove.ts
View Options
import
{
predicates
,
ShapeToType
}
from
"@sealcode/ts-predicates"
;
import
type
Context
from
"../../../../context.js"
;
import
{
ArrayAction
}
from
"./array-action.js"
;
const
RemoveInputShape
=
{
remove
:
predicates
.
or
(
predicates
.
string
,
predicates
.
number
),
};
const
RemoveParsedShape
=
{
remove
:
predicates
.
number
};
export
class
Remove
extends
ArrayAction
<
ShapeToType
<
typeof
RemoveInputShape
>
,
ShapeToType
<
typeof
RemoveParsedShape
>
>
{
InputShape
=
RemoveInputShape
;
async
_parse
(
_context
:
Context
,
input
:
ShapeToType
<
typeof
RemoveInputShape
>
)
:
Promise
<
ShapeToType
<
typeof
RemoveParsedShape
>
|
null
>
{
return
{
remove
:
parseInt
(
input
.
remove
.
toString
())
};
}
async
run
<
T
>
(
_context
:
Context
,
action
:
ShapeToType
<
typeof
RemoveParsedShape
>
,
array
:
T
[]
)
{
array
=
array
.
filter
((
_
,
i
)
=>
{
return
i
!==
action
.
remove
;
});
return
array
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:51 (17 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
636233
Default Alt Text
remove.ts (869 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment