Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010479
hyphenation.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
757 B
Referenced Files
None
Subscribers
None
hyphenation.ts
View Options
import
hyphenopoly
from
"hyphenopoly"
;
import
{
resolve
}
from
"node:path"
;
import
{
readFile
}
from
"node:fs/promises"
;
import
{
fileURLToPath
}
from
"node:url"
;
async
function
make_hyphenator
(
lang
:
string
)
{
return
hyphenopoly
.
config
({
require
:
[
lang
],
sync
:
false
,
loader
:
async
(
file
:
string
,
module_path
:
URL
)
=>
{
return
readFile
(
resolve
(
fileURLToPath
(
module_path
),
`../patterns/
${
file
}
`
)
);
},
});
}
const
hyphenators
:
Record
<
string
,
Promise
<
(
text
:
string
)
=>
string
>
|
undefined
>
=
{};
export
function
get_hyphenator
(
lang
:
string
)
:
Promise
<
(
text
:
string
)
=>
string
>
{
const
hyphenator
=
hyphenators
[
lang
]
||
make_hyphenator
(
lang
);
if
(
!
hyphenators
[
lang
])
{
hyphenators
[
lang
]
=
hyphenator
;
}
return
hyphenator
;
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:43 (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625519
Default Alt Text
hyphenation.ts (757 B)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment