stringz icon indicating copy to clipboard operation
stringz copied to clipboard

Improve unicode support

Open Richienb opened this issue 1 year ago • 3 comments

Require Node.js 16 and move to ESM

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

Fixes #50, Fixes #33

Richienb avatar Jul 18 '22 05:07 Richienb

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?

sallar avatar Sep 06 '22 14:09 sallar

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

Richienb avatar Sep 08 '22 06:09 Richienb

@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

sallar avatar Sep 09 '22 13:09 sallar