@mkody/twitch-emoticons 2.7.0 → 2.7.1

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.
Files changed (43) hide show
  1. package/.eslintrc.json +143 -143
  2. package/.github/codeql/codeql-config.yml +4 -4
  3. package/.github/workflows/codeql.yml +50 -50
  4. package/.github/workflows/eslint.yml +50 -50
  5. package/.github/workflows/release.yml +22 -0
  6. package/.github/workflows/yarn-test.yml +17 -17
  7. package/.jsdoc.json +39 -39
  8. package/.nvmrc +1 -0
  9. package/LICENSE +22 -22
  10. package/docs/BTTVEmote.html +1319 -1319
  11. package/docs/Channel.html +823 -823
  12. package/docs/Collection.html +797 -797
  13. package/docs/Emote.html +801 -801
  14. package/docs/EmoteFetcher.html +2946 -2946
  15. package/docs/EmoteParser.html +811 -811
  16. package/docs/FFZEmote.html +1473 -1473
  17. package/docs/SevenTV.html +1190 -1190
  18. package/docs/SevenTVEmote.html +1395 -1395
  19. package/docs/TwitchEmote.html +1315 -1315
  20. package/docs/index.html +206 -206
  21. package/docs/struct_BTTVEmote.js.html +132 -132
  22. package/docs/struct_Channel.js.html +127 -127
  23. package/docs/struct_Emote.js.html +138 -138
  24. package/docs/struct_EmoteFetcher.js.html +395 -399
  25. package/docs/struct_EmoteParser.js.html +153 -153
  26. package/docs/struct_FFZEmote.js.html +146 -146
  27. package/docs/struct_SevenTVEmote.js.html +141 -141
  28. package/docs/struct_TwitchEmote.js.html +130 -130
  29. package/docs/util_Collection.js.html +150 -150
  30. package/package.json +57 -57
  31. package/src/index.js +12 -12
  32. package/src/struct/BTTVEmote.js +60 -60
  33. package/src/struct/Channel.js +55 -55
  34. package/src/struct/Emote.js +66 -66
  35. package/src/struct/EmoteFetcher.js +323 -327
  36. package/src/struct/EmoteParser.js +81 -81
  37. package/src/struct/FFZEmote.js +74 -74
  38. package/src/struct/SevenTVEmote.js +69 -69
  39. package/src/struct/TwitchEmote.js +58 -58
  40. package/src/util/Collection.js +78 -78
  41. package/src/util/Constants.js +31 -31
  42. package/test/index.js +174 -174
  43. package/typings/index.d.ts +98 -98
@@ -1,153 +1,153 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
-
5
- <meta charset="utf-8">
6
- <title>struct/EmoteParser.js - Documentation</title>
7
-
8
-
9
- <script src="scripts/prettify/prettify.js"></script>
10
- <script src="scripts/prettify/lang-css.js"></script>
11
- <!--[if lt IE 9]>
12
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
- <![endif]-->
14
- <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
- <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
- <script src="scripts/nav.js" defer></script>
17
-
18
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
- </head>
20
- <body>
21
-
22
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
- <label for="nav-trigger" class="navicon-button x">
24
- <div class="navicon"></div>
25
- </label>
26
-
27
- <label for="nav-trigger" class="overlay"></label>
28
-
29
- <nav >
30
-
31
-
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toString">toString</a></li></ul></li></ul>
33
-
34
- </nav>
35
-
36
- <div id="main">
37
-
38
- <h1 class="page-title">struct/EmoteParser.js</h1>
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- <section>
47
- <article>
48
- <pre class="prettyprint source linenums"><code>const Constants = require('../util/Constants');
49
-
50
- class EmoteParser {
51
- /**
52
- * A parser to replace text with emotes.
53
- * @param {EmoteFetcher} fetcher - The fetcher to use the cache of.
54
- * @param {Object} [options={}] - Options for the parser.
55
- * @param {string} [options.template] - The template to be used.
56
- * The strings that can be interpolated are:
57
- * - `{link}` The link of the emote.
58
- * - `{name}` The name of the emote.
59
- * - `{size}` The size of the image.
60
- * - `{creator}` The channel/owner name of the emote.
61
- * @param {string} [options.type='markdown'] - The type of the parser.
62
- * Can be one of `markdown`, `html`, `bbcode`, or `plain`.
63
- * If the `template` option is provided, this is ignored.
64
- * @param {RegExp} [options.match=/:(.+?):/g] - The regular expression that matches an emote.
65
- * Must be a global regex, with one capture group for the emote code.
66
- */
67
- constructor(fetcher, options = {}) {
68
- /**
69
- * The emote fetcher being used.
70
- * @type {EmoteFetcher}
71
- */
72
- this.fetcher = fetcher;
73
-
74
- /**
75
- * The parser options.
76
- * @type {Object}
77
- */
78
- this.options = Object.assign({
79
- template: '',
80
- type: 'markdown',
81
- match: /:(.+?):/g
82
- }, options);
83
-
84
- this._validateOptions(this.options);
85
- }
86
-
87
- _validateOptions(options) {
88
- if (options.template &amp;&amp; typeof options.template !== 'string') {
89
- throw new TypeError('Template must be a string');
90
- }
91
-
92
- if (!['markdown', 'html', 'bbcode', 'plain'].includes(options.type)) {
93
- throw new TypeError('Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`');
94
- }
95
-
96
- if (!(options.match instanceof RegExp) || !options.match.global) {
97
- throw new TypeError('Match must be a global RegExp.');
98
- }
99
- }
100
-
101
- /**
102
- * Parses text.
103
- * @param {string} text - Text to parse.
104
- * @param {number} size - Size for emotes.
105
- * @returns {string}
106
- */
107
- parse(text, size = 0) {
108
- const parsed = text.replace(this.options.match, (matched, id) => {
109
- const emote = this.fetcher.emotes.get(id);
110
- if (!emote) return matched;
111
- if (emote.modifier) return '';
112
-
113
- const template = this.options.template || Constants.Templates[this.options.type];
114
- const link = emote.toLink(size);
115
- const res = template
116
- .replace(/{link}/g, link)
117
- .replace(/{name}/g, emote.code)
118
- .replace(/{size}/g, size)
119
- .replace(/{creator}/g, emote.ownerName || 'global');
120
-
121
- return res;
122
- });
123
-
124
- return parsed;
125
- }
126
- }
127
-
128
- module.exports = EmoteParser;
129
- </code></pre>
130
- </article>
131
- </section>
132
-
133
-
134
-
135
-
136
-
137
-
138
- </div>
139
-
140
- <br class="clear">
141
-
142
- <footer>
143
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
144
- </footer>
145
-
146
- <script>prettyPrint();</script>
147
- <script src="scripts/polyfill.js"></script>
148
- <script src="scripts/linenumber.js"></script>
149
-
150
-
151
-
152
- </body>
153
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>struct/EmoteParser.js - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toString">toString</a></li></ul></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">struct/EmoteParser.js</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>const Constants = require('../util/Constants');
49
+
50
+ class EmoteParser {
51
+ /**
52
+ * A parser to replace text with emotes.
53
+ * @param {EmoteFetcher} fetcher - The fetcher to use the cache of.
54
+ * @param {Object} [options={}] - Options for the parser.
55
+ * @param {string} [options.template] - The template to be used.
56
+ * The strings that can be interpolated are:
57
+ * - `{link}` The link of the emote.
58
+ * - `{name}` The name of the emote.
59
+ * - `{size}` The size of the image.
60
+ * - `{creator}` The channel/owner name of the emote.
61
+ * @param {string} [options.type='markdown'] - The type of the parser.
62
+ * Can be one of `markdown`, `html`, `bbcode`, or `plain`.
63
+ * If the `template` option is provided, this is ignored.
64
+ * @param {RegExp} [options.match=/:(.+?):/g] - The regular expression that matches an emote.
65
+ * Must be a global regex, with one capture group for the emote code.
66
+ */
67
+ constructor(fetcher, options = {}) {
68
+ /**
69
+ * The emote fetcher being used.
70
+ * @type {EmoteFetcher}
71
+ */
72
+ this.fetcher = fetcher;
73
+
74
+ /**
75
+ * The parser options.
76
+ * @type {Object}
77
+ */
78
+ this.options = Object.assign({
79
+ template: '',
80
+ type: 'markdown',
81
+ match: /:(.+?):/g
82
+ }, options);
83
+
84
+ this._validateOptions(this.options);
85
+ }
86
+
87
+ _validateOptions(options) {
88
+ if (options.template &amp;&amp; typeof options.template !== 'string') {
89
+ throw new TypeError('Template must be a string');
90
+ }
91
+
92
+ if (!['markdown', 'html', 'bbcode', 'plain'].includes(options.type)) {
93
+ throw new TypeError('Parse type must be one of `markdown`, `html`, `bbcode`, or `plain`');
94
+ }
95
+
96
+ if (!(options.match instanceof RegExp) || !options.match.global) {
97
+ throw new TypeError('Match must be a global RegExp.');
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Parses text.
103
+ * @param {string} text - Text to parse.
104
+ * @param {number} size - Size for emotes.
105
+ * @returns {string}
106
+ */
107
+ parse(text, size = 0) {
108
+ const parsed = text.replace(this.options.match, (matched, id) => {
109
+ const emote = this.fetcher.emotes.get(id);
110
+ if (!emote) return matched;
111
+ if (emote.modifier) return '';
112
+
113
+ const template = this.options.template || Constants.Templates[this.options.type];
114
+ const link = emote.toLink(size);
115
+ const res = template
116
+ .replace(/{link}/g, link)
117
+ .replace(/{name}/g, emote.code)
118
+ .replace(/{size}/g, size)
119
+ .replace(/{creator}/g, emote.ownerName || 'global');
120
+
121
+ return res;
122
+ });
123
+
124
+ return parsed;
125
+ }
126
+ }
127
+
128
+ module.exports = EmoteParser;
129
+ </code></pre>
130
+ </article>
131
+ </section>
132
+
133
+
134
+
135
+
136
+
137
+
138
+ </div>
139
+
140
+ <br class="clear">
141
+
142
+ <footer>
143
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
144
+ </footer>
145
+
146
+ <script>prettyPrint();</script>
147
+ <script src="scripts/polyfill.js"></script>
148
+ <script src="scripts/linenumber.js"></script>
149
+
150
+
151
+
152
+ </body>
153
+ </html>
@@ -1,146 +1,146 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
-
5
- <meta charset="utf-8">
6
- <title>struct/FFZEmote.js - Documentation</title>
7
-
8
-
9
- <script src="scripts/prettify/prettify.js"></script>
10
- <script src="scripts/prettify/lang-css.js"></script>
11
- <!--[if lt IE 9]>
12
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
- <![endif]-->
14
- <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
- <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
- <script src="scripts/nav.js" defer></script>
17
-
18
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
- </head>
20
- <body>
21
-
22
- <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
- <label for="nav-trigger" class="navicon-button x">
24
- <div class="navicon"></div>
25
- </label>
26
-
27
- <label for="nav-trigger" class="overlay"></label>
28
-
29
- <nav >
30
-
31
-
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toString">toString</a></li></ul></li></ul>
33
-
34
- </nav>
35
-
36
- <div id="main">
37
-
38
- <h1 class="page-title">struct/FFZEmote.js</h1>
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- <section>
47
- <article>
48
- <pre class="prettyprint source linenums"><code>const Emote = require('./Emote');
49
- const Constants = require('../util/Constants');
50
-
51
- /** @extends Emote */
52
- class FFZEmote extends Emote {
53
- /**
54
- * An FFZ emote.
55
- * @param {Channel} channel - Channel this emote belongs to.
56
- * @param {string} id - ID of the emote.
57
- * @param {data} data - The raw emote data.
58
- */
59
- constructor(channel, id, data) {
60
- super(channel, id, data);
61
- this.type = 'ffz';
62
- }
63
-
64
- /**
65
- * The channel of this emote's creator.
66
- * Not guaranteed to contain the emote, or be cached.
67
- * @readonly
68
- * @type {?Channel}
69
- */
70
- get owner() {
71
- return this.fetcher.channels.get(this.ownerName);
72
- }
73
-
74
- _setup(data) {
75
- super._setup(data);
76
- this.code = data.name;
77
-
78
- /**
79
- * The name of the emote creator's channel.
80
- * @type {string}
81
- */
82
- this.ownerName = data.owner.name;
83
-
84
- /**
85
- * Available image sizes.
86
- * @type {string[]}
87
- */
88
- this.sizes = 'animated' in data ? Object.keys(data.animated) : Object.keys(data.urls);
89
-
90
- /**
91
- * If emote is animated.
92
- * @type {boolean}
93
- */
94
- this.animated = 'animated' in data;
95
-
96
- /**
97
- * The image type of the emote.
98
- * @type {string}
99
- */
100
- this.imageType = 'animated' in data ? 'webp' : 'png';
101
-
102
- /**
103
- * If the emote is a modifier and should be hidden.
104
- * @type {boolean}
105
- */
106
- this.modifier = data.modifier &amp;&amp; (data.modifier_flags &amp; 1) !== 0;
107
- }
108
-
109
- /**
110
- * Gets the image link of the emote.
111
- * @param {number} size - The size of the image.
112
- * @returns {string}
113
- */
114
- toLink(size = 0) {
115
- size = this.sizes[size];
116
- if (this.animated) return Constants.FFZ.CDNAnimated(this.id, size); // eslint-disable-line new-cap
117
- return Constants.FFZ.CDN(this.id, size); // eslint-disable-line new-cap
118
- }
119
- }
120
-
121
- module.exports = FFZEmote;
122
- </code></pre>
123
- </article>
124
- </section>
125
-
126
-
127
-
128
-
129
-
130
-
131
- </div>
132
-
133
- <br class="clear">
134
-
135
- <footer>
136
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
137
- </footer>
138
-
139
- <script>prettyPrint();</script>
140
- <script src="scripts/polyfill.js"></script>
141
- <script src="scripts/linenumber.js"></script>
142
-
143
-
144
-
145
- </body>
146
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+
5
+ <meta charset="utf-8">
6
+ <title>struct/FFZEmote.js - Documentation</title>
7
+
8
+
9
+ <script src="scripts/prettify/prettify.js"></script>
10
+ <script src="scripts/prettify/lang-css.js"></script>
11
+ <!--[if lt IE 9]>
12
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
13
+ <![endif]-->
14
+ <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
+ <script src="scripts/nav.js" defer></script>
17
+
18
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
19
+ </head>
20
+ <body>
21
+
22
+ <input type="checkbox" id="nav-trigger" class="nav-trigger" />
23
+ <label for="nav-trigger" class="navicon-button x">
24
+ <div class="navicon"></div>
25
+ </label>
26
+
27
+ <label for="nav-trigger" class="overlay"></label>
28
+
29
+ <nav >
30
+
31
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BTTVEmote.html">BTTVEmote</a><ul class='methods'><li data-type='method'><a href="BTTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="BTTVEmote.html#toString">toString</a></li></ul></li><li><a href="Channel.html">Channel</a><ul class='methods'><li data-type='method'><a href="Channel.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="Channel.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="Channel.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li></ul></li><li><a href="Collection.html">Collection</a><ul class='methods'><li data-type='method'><a href="Collection.html#filter">filter</a></li><li data-type='method'><a href="Collection.html#find">find</a></li><li data-type='method'><a href="Collection.html#map">map</a></li></ul></li><li><a href="Emote.html">Emote</a><ul class='methods'><li data-type='method'><a href="Emote.html#toString">toString</a></li></ul></li><li><a href="EmoteFetcher.html">EmoteFetcher</a><ul class='methods'><li data-type='method'><a href="EmoteFetcher.html#_cacheBTTVEmote">_cacheBTTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheFFZEmote">_cacheFFZEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheSevenTVEmote">_cacheSevenTVEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_cacheTwitchEmote">_cacheTwitchEmote</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawBTTVEmotes">_getRawBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmoteSet">_getRawFFZEmoteSet</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawFFZEmotes">_getRawFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawSevenTVEmotes">_getRawSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#_getRawTwitchEmotes">_getRawTwitchEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchBTTVEmotes">fetchBTTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchFFZEmotes">fetchFFZEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchSevenTVEmotes">fetchSevenTVEmotes</a></li><li data-type='method'><a href="EmoteFetcher.html#fetchTwitchEmotes">fetchTwitchEmotes</a></li></ul></li><li><a href="EmoteParser.html">EmoteParser</a><ul class='methods'><li data-type='method'><a href="EmoteParser.html#parse">parse</a></li></ul></li><li><a href="FFZEmote.html">FFZEmote</a><ul class='methods'><li data-type='method'><a href="FFZEmote.html#toLink">toLink</a></li><li data-type='method'><a href="FFZEmote.html#toString">toString</a></li></ul></li><li><a href="SevenTVEmote.html">SevenTVEmote</a><ul class='methods'><li data-type='method'><a href="SevenTVEmote.html#toLink">toLink</a></li><li data-type='method'><a href="SevenTVEmote.html#toString">toString</a></li></ul></li><li><a href="TwitchEmote.html">TwitchEmote</a><ul class='methods'><li data-type='method'><a href="TwitchEmote.html#toLink">toLink</a></li><li data-type='method'><a href="TwitchEmote.html#toString">toString</a></li></ul></li></ul>
33
+
34
+ </nav>
35
+
36
+ <div id="main">
37
+
38
+ <h1 class="page-title">struct/FFZEmote.js</h1>
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ <section>
47
+ <article>
48
+ <pre class="prettyprint source linenums"><code>const Emote = require('./Emote');
49
+ const Constants = require('../util/Constants');
50
+
51
+ /** @extends Emote */
52
+ class FFZEmote extends Emote {
53
+ /**
54
+ * An FFZ emote.
55
+ * @param {Channel} channel - Channel this emote belongs to.
56
+ * @param {string} id - ID of the emote.
57
+ * @param {data} data - The raw emote data.
58
+ */
59
+ constructor(channel, id, data) {
60
+ super(channel, id, data);
61
+ this.type = 'ffz';
62
+ }
63
+
64
+ /**
65
+ * The channel of this emote's creator.
66
+ * Not guaranteed to contain the emote, or be cached.
67
+ * @readonly
68
+ * @type {?Channel}
69
+ */
70
+ get owner() {
71
+ return this.fetcher.channels.get(this.ownerName);
72
+ }
73
+
74
+ _setup(data) {
75
+ super._setup(data);
76
+ this.code = data.name;
77
+
78
+ /**
79
+ * The name of the emote creator's channel.
80
+ * @type {?string}
81
+ */
82
+ this.ownerName = 'owner' in data ? data.owner.name : null;
83
+
84
+ /**
85
+ * Available image sizes.
86
+ * @type {string[]}
87
+ */
88
+ this.sizes = 'animated' in data ? Object.keys(data.animated) : Object.keys(data.urls);
89
+
90
+ /**
91
+ * If emote is animated.
92
+ * @type {boolean}
93
+ */
94
+ this.animated = 'animated' in data;
95
+
96
+ /**
97
+ * The image type of the emote.
98
+ * @type {string}
99
+ */
100
+ this.imageType = 'animated' in data ? 'webp' : 'png';
101
+
102
+ /**
103
+ * If the emote is a modifier and should be hidden.
104
+ * @type {boolean}
105
+ */
106
+ this.modifier = data.modifier &amp;&amp; (data.modifier_flags &amp; 1) !== 0;
107
+ }
108
+
109
+ /**
110
+ * Gets the image link of the emote.
111
+ * @param {number} size - The size of the image.
112
+ * @returns {string}
113
+ */
114
+ toLink(size = 0) {
115
+ size = this.sizes[size];
116
+ if (this.animated) return Constants.FFZ.CDNAnimated(this.id, size); // eslint-disable-line new-cap
117
+ return Constants.FFZ.CDN(this.id, size); // eslint-disable-line new-cap
118
+ }
119
+ }
120
+
121
+ module.exports = FFZEmote;
122
+ </code></pre>
123
+ </article>
124
+ </section>
125
+
126
+
127
+
128
+
129
+
130
+
131
+ </div>
132
+
133
+ <br class="clear">
134
+
135
+ <footer>
136
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
137
+ </footer>
138
+
139
+ <script>prettyPrint();</script>
140
+ <script src="scripts/polyfill.js"></script>
141
+ <script src="scripts/linenumber.js"></script>
142
+
143
+
144
+
145
+ </body>
146
+ </html>