emotesjs 0.0.12 → 0.0.14

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 (2) hide show
  1. package/index.js +15 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -58,7 +58,7 @@ class EmotesJS {
58
58
  let name = emote.data.name
59
59
  let url = `https:${emote.data.host.url}`
60
60
 
61
- if (!this.allowedOrigins.includes(url)) {
61
+ if (!url.includes(this.allowedOrigins)) {
62
62
  continue
63
63
  }
64
64
 
@@ -74,24 +74,29 @@ class EmotesJS {
74
74
 
75
75
  parse(text) {
76
76
  if (!text || !this.isReady) {
77
+ console.log('emotes not ready')
77
78
  return text
78
79
  }
80
+
81
+ if (this.isReady && this.cachedEmotes.size === 0) {
82
+ console.log('no emotes loaded')
83
+ return text
84
+ }
85
+
79
86
  let words = text.split(' ')
80
87
 
81
88
  let fullText = ''
82
89
  for (let i = 0; i < words.length; i++) {
83
90
  let word = words[i]
84
91
 
85
- if (this.requireColon && !word.startsWith(":")) {
86
- continue
87
- }
88
-
89
- let wordKey = word.replace(':', '')
90
- let emote = this.cachedEmotes.get(wordKey)
92
+ if (this.requireColon && word.startsWith(":")) {
93
+ let wordKey = word.replace(':', '')
94
+ let emote = this.cachedEmotes.get(wordKey)
91
95
 
92
- if (emote) {
93
- fullText += emote + ' '
94
- continue;
96
+ if (emote) {
97
+ fullText += emote + ' '
98
+ continue;
99
+ }
95
100
  }
96
101
 
97
102
  fullText += word + " "
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "emotesjs",
3
3
  "description": "",
4
- "version": "0.0.12",
4
+ "version": "0.0.14",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "darckfast"