Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve unicode support #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Richienb
Copy link
Contributor

@Richienb Richienb commented Jul 18, 2022

Require Node.js 16 and move to ESM

Intl.Segmenter is much more accurate than the regex was.

Fixes #50, Fixes #33

Signed-off-by: Richie Bendall <[email protected]>
@sallar
Copy link
Owner

sallar commented Sep 6, 2022

Hi.

Thanks. Im happy to discuss merging this in, I have two concerns though:

  • Moving to ESM completely might break some projects that don't support it yet.
  • Support for Intl.Segmenter is not universal.

Maybe we can release the current (non-esm) version to npm using a @legacy tag or something and then do a breaking release with the new changes. What do you think?

@Richienb
Copy link
Contributor Author

Richienb commented Sep 8, 2022

I'm ok with breaking ESM support but a lack of Intl.Segmenter support is a problem. Not sure what to do.

@sallar
Copy link
Owner

sallar commented Sep 9, 2022

@Richienb then I think I can add a legacy sub-import to fix this. eg:

if imported from ES6 -> Intl.Segmenter
if imported from commonJS -> older version

OR

import stringz from 'stringz' -> Intl.Segmenter
import stringz from 'stringz/legacy' -> older version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

question about performance Incorrect length for some strings
2 participants