Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1263074
util.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
718 B
Referenced Files
None
Subscribers
None
util.ts
View Options
import
{
BaseContext
}
from
"koa"
;
import
qs
from
"qs"
;
import
{
dirname
}
from
"node:path"
;
export
async
function
sleep
(
time
:
number
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
export
type
Awaited
<
T
>
=
T
extends
Promise
<
infer
U
>
?
U
:
T
;
export
type
UnwrapArray
<
T
>
=
T
extends
Array
<
infer
U
>
?
U
:
T
;
export
function
*
naturalNumbers
(
min
:
number
,
max
:
number
)
{
for
(
let
i
=
min
;
i
<=
max
;
i
++
)
{
yield
i
;
}
}
export
function
UrlWithNewParams
(
ctx
:
BaseContext
,
query_params
:
Record
<
string
,
unknown
>
)
:
string
{
return
`
${
ctx
.
path
}
?
${
qs
.
stringify
(
query_params
)
}
`
;
}
export
function
module_dirname
(
module_url
:
string
)
:
string
{
return
dirname
(
module_url
).
replace
(
/^file:\/\//
,
""
);
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 16:50 (12 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
601179
Default Alt Text
util.ts (718 B)
Attached To
Mode
rREWRITE Configurable rewriter
Attached
Detach File
Event Timeline
Log In to Comment