Unwanted MIN_WORD_LENGTH_BOUNDRY
kamilmielnik opened this issue · 5 comments
The minWordLength
setting is limited by MIN_WORD_LENGTH_BOUNDRY
(https://github.com/ytiurin/hyphen/blob/master/src/create-hyphenator.js#L64-L67).
My use-case requires hyphenating all the words (I know what I am doing, performance is not important) but this limitation renders the library useless for my case.
Please remove MIN_WORD_LENGTH_BOUNDRY
.
Hi @kamilmielnik !
You can create a hyphenator function for your use case with the following code:
import createHyphenator from "hyphen";
import patterns from "hyphen/patterns/en-us";
const hyphenate = createHyphenator(patterns, { minWordLength: 1 });
export default hyphenate;
and then import it in your files:
import hyphenator from './my-hyphenator';
hyphenate('My text');
Does this solve your issue?
But looking at the code minWordLength
can't be lower than 5
. Or am I mistaken?
Does this solve your issue?
@ytiurin No, the code that you posted suffers from the same problem.
But looking at the code
minWordLength
can't be lower than5
.
Precisely!
It's this part of code that is problematic: https://github.com/ytiurin/hyphen/blob/master/src/create-hyphenator.js#L64-L67
I think it makes sense to remove that limitation and just use 5
as a default value for minWordLength
at your own risk for the hyphenation becoming slow.
Want to submit a PR?
I think it makes sense to remove that limitation and just use
5
as a default value forminWordLength
at your own risk for the hyphenation becoming slow.
I agree.
@krisztianb there it is: #38
Thanks!