diff --git a/.changeset/calm-maps-tickle.md b/.changeset/calm-maps-tickle.md deleted file mode 100644 index 06f331c..0000000 --- a/.changeset/calm-maps-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"unicode-segmenter": patch ---- - -Correct some type definitions diff --git a/.changeset/clever-cherries-nail.md b/.changeset/clever-cherries-nail.md deleted file mode 100644 index 292db17..0000000 --- a/.changeset/clever-cherries-nail.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"unicode-segmenter": minor ---- - -Expose `/utils` entry with a helpful API - -- `takeChar(input, cursor)`: take a utf8 character from given input by cursor diff --git a/.changeset/five-beers-act.md b/.changeset/five-beers-act.md deleted file mode 100644 index 24fafdf..0000000 --- a/.changeset/five-beers-act.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"unicode-segmenter": minor ---- - -Add `countGrapheme` utility diff --git a/.changeset/flat-mugs-film.md b/.changeset/flat-mugs-film.md deleted file mode 100644 index db64c10..0000000 --- a/.changeset/flat-mugs-film.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"unicode-segmenter": minor ---- - -Expose some low-level APIs that might help other dependents diff --git a/.changeset/healthy-horses-relate.md b/.changeset/healthy-horses-relate.md deleted file mode 100644 index 838deb2..0000000 --- a/.changeset/healthy-horses-relate.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"unicode-segmenter": patch ---- - -Optimize perf again diff --git a/.changeset/rude-drinks-taste.md b/.changeset/rude-drinks-taste.md deleted file mode 100644 index 7cb895b..0000000 --- a/.changeset/rude-drinks-taste.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"unicode-segmenter": patch ---- - -Fix edge cases around ZWJ diff --git a/.changeset/small-moles-carry.md b/.changeset/small-moles-carry.md deleted file mode 100644 index f6bb97b..0000000 --- a/.changeset/small-moles-carry.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -"unicode-segmenter": minor ---- - -- New entries for Unicode's general and emoji properties - - ```js - import { - isLetter, // match w/ \p{L} - isNumeric, // match w/ \p{N} - isAlphabetic, // match w/ \p{Alphabetic} - isAlphanumeric, // match w/ [\p{N}\p{Alphabetic}] - } from 'unicode-segmenter/general'; - - import { - isEmoji, // match w/ \p{Extended_Pictographic} - isEmojiPresentation, // match w/ \p{Emoji_Presentation} - } from "unicode-segmenter/emoji"; - ``` - -- Grapheme segementer now yields matched category to `_cat` field. - It will be useful when building custom matchers by the category - - e.g. custom emoji matcher: - - ```js - function* matchEmoji(str) { - for (let { index, segment, input, _cat } of graphemeSegments(str)) { - if (_cat === GraphemeCategory.Extended_Pictographic) { - yield { emoji: segment, index }; - } - } - } - ``` diff --git a/.changeset/thin-chicken-drive.md b/.changeset/thin-chicken-drive.md deleted file mode 100644 index fc02ccc..0000000 --- a/.changeset/thin-chicken-drive.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"unicode-segmenter": minor ---- - -Add more low-level utilities - -- `isHighSurrogate` check if a UTF-16 code in high surrogate -- `isLowSurragate` check if a UTF-16 code in low surrogate -- `surrogatePairToCodePoint` convert given surrogate pair to a Unicode code point diff --git a/CHANGELOG.md b/CHANGELOG.md index a87db8e..33829b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,58 @@ # unicode-segmenter +## 0.3.0 + +### Minor Changes + +- c74c6a0: Expose `/utils` entry with a helpful API + + - `takeChar(input, cursor)`: take a utf8 character from given input by cursor + +- c3ceaa5: Add `countGrapheme` utility +- 955814a: Expose some low-level APIs that might help other dependents +- 7592c3b: - New entries for Unicode's general and emoji properties + + ```js + import { + isLetter, // match w/ \p{L} + isNumeric, // match w/ \p{N} + isAlphabetic, // match w/ \p{Alphabetic} + isAlphanumeric, // match w/ [\p{N}\p{Alphabetic}] + } from "unicode-segmenter/general"; + + import { + isEmoji, // match w/ \p{Extended_Pictographic} + isEmojiPresentation, // match w/ \p{Emoji_Presentation} + } from "unicode-segmenter/emoji"; + ``` + + - Grapheme segementer now yields matched category to `_cat` field. + It will be useful when building custom matchers by the category + + e.g. custom emoji matcher: + + ```js + function* matchEmoji(str) { + for (let { index, segment, input, _cat } of graphemeSegments(str)) { + if (_cat === GraphemeCategory.Extended_Pictographic) { + yield { emoji: segment, index }; + } + } + } + ``` + +- 7592c3b: Add more low-level utilities + + - `isHighSurrogate` check if a UTF-16 code in high surrogate + - `isLowSurragate` check if a UTF-16 code in low surrogate + - `surrogatePairToCodePoint` convert given surrogate pair to a Unicode code point + +### Patch Changes + +- 7592c3b: Correct some type definitions +- 900f959: Optimize perf again +- 3db955b: Fix edge cases around ZWJ + ## 0.2.0 ### Minor Changes diff --git a/package.json b/package.json index a5fff5e..4cc122a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unicode-segmenter", - "version": "0.2.0", + "version": "0.3.0", "type": "module", "description": "A lightweight and fast, pure JavaScript library for Unicode segmentation", "license": "MIT",