xorgy / grapheme-iterator

An iterator yielding each Unicode Extended Grapheme Cluster in a string.
ISC License
6 stars 2 forks source link

Code sample snippet? #4

Open Cobertos opened 3 years ago

Cobertos commented 3 years ago

Would be nice if the README had a little snippet showing how to use this? Just to more quickly onboard people.

xorgy commented 2 years ago

That's a good point I suppose. If you want to rip some examples off from another grapheme splitting library and put together a little README, I'll merge it. Otherwise I'm sticking to functional changes, for the near future.

If you didn't have time to figure it out yourself, you can see the API in the TypeScript definition file index.d.ts. The module has a single default export, which is a function that takes a single argument that is a string or an iterable of Unicode Scalar Values as strings and returns an iterable of strings representing whole Extended Grapheme Clusters.