@mkody/twitch-emoticons 3.0.0-beta.5 → 3.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,7 @@ Gets Twitch, BTTV, FFZ and 7TV emotes as well as parsing text to emotes!
22
22
  - The initialization of `EmoteFetcher` changed to only use an object as the first parameter for options.
23
23
  - API keys for Twitch must now be set with `twitchAppID` and `twitchAppSecret` properties.
24
24
  - The previously available `apiClient` is now set in this object too.
25
- - The defaults for `EmoteParser` changed to use the `html` template, and it does not require `:colons:` by default (using `/(\w+)/` to match any words).
25
+ - The defaults for `EmoteParser` changed to use the `html` template, and it does not require `:colons:` by default (using `/([^\s]+)/g` to match non-whitespaces).
26
26
  - The default `html` template does not have `twitch-emote-{size}` anymore in its `class` attribute.
27
27
  *The `size` is inconsistent between the different sources, so it cannot be reliably used.*
28
28
  - If you somehow used `EmoteFetcher.globalChannel`, it has now been removed.
@@ -124,12 +124,12 @@ pnpm add jsr:@mkody/twitch-emoticons
124
124
  # or
125
125
  yarn add jsr:@mkody/twitch-emoticons
126
126
  # or (version has to be specified while it is a pre-release)
127
- deno add jsr:@mkody/twitch-emoticons@3.0.0-beta.4
127
+ deno add jsr:@mkody/twitch-emoticons@3.0.0-beta.6
128
128
  ```
129
129
 
130
- [npm]: https://www.npmjs.com/package/@mkody/twitch-emoticons/v/3.0.0-beta.4
131
- [browse on npmx]: https://npmx.dev/package/@mkody/twitch-emoticons/v/3.0.0-beta.4
132
- [jsr]: https://jsr.io/@mkody/twitch-emoticons@3.0.0-beta.4
130
+ [npm]: https://www.npmjs.com/package/@mkody/twitch-emoticons/v/3.0.0-beta.6
131
+ [browse on npmx]: https://npmx.dev/package/@mkody/twitch-emoticons/v/3.0.0-beta.6
132
+ [jsr]: https://jsr.io/@mkody/twitch-emoticons@3.0.0-beta.6
133
133
 
134
134
 
135
135
  ## Quick docs
@@ -230,7 +230,7 @@ const parser = new EmoteParser(
230
230
  template, // <string> - Default: ''
231
231
 
232
232
  // You can customize the regular expression used to find possible emotes.
233
- match, // <RegExp> - Default: /(\w+)/g
233
+ match, // <RegExp> - Default: /([^\s]+)/g
234
234
  },
235
235
  )
236
236
  ```
@@ -284,9 +284,9 @@ const fetcher = new EmoteFetcher({
284
284
  const parser = new EmoteParser(fetcher, {
285
285
  type: 'markdown', // Can be `html` (default), `markdown`, `bbcode`, or `plain`.
286
286
  // You can also set your own output, see example 3.
287
- match: /:(.+?):/g, // This means your emotes must be between colons (:Kappa:).
288
- // The default is /(\w+)/g and matches any word characters,
289
- // similar to regular Twitch chat.
287
+ match: /:(.+?):/g, // Requires emotes to be between colons (:Kappa:).
288
+ // The default `/([^\s]+)/g` matches any non-whitespace
289
+ // characters, similar to regular Twitch chat.
290
290
  })
291
291
 
292
292
  await fetcher.fetchTwitchEmotes(null) // `null` or a missing parameter will load "global" emotes.
@@ -954,7 +954,7 @@ var EmoteParser = class {
954
954
  * @param {'html' | 'markdown' | 'bbcode' | 'plain'} [options.type='html'] - The type of the parser.
955
955
  * Can be one of `html`, `markdown`, `bbcode`, or `plain`.
956
956
  * If the `template` option is provided, this is ignored.
957
- * @param {RegExp} [options.match=/(\w+)/g] - The regular expression that matches an emote.
957
+ * @param {RegExp} [options.match=/([^\s]+)/g] - The regular expression that matches an emote.
958
958
  * Must be a global regex, with one capture group for the emote code.
959
959
  */
960
960
  constructor(fetcher, options = {}) {
@@ -962,7 +962,7 @@ var EmoteParser = class {
962
962
  this.options = {
963
963
  template: "",
964
964
  type: "html",
965
- match: /(\w+)/g,
965
+ match: /([^\s]+)/g,
966
966
  ...options
967
967
  };
968
968
  this._validateOptions(this.options);