emotesjs 0.0.14 → 0.0.16

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 +14 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -15,8 +15,8 @@ class EmotesJS {
15
15
  }
16
16
 
17
17
  if (opts) {
18
- this.channelId = opts.channelId || this.channelId
19
- this.requireColon = opts.requireColon || this.requireColon
18
+ this.channelId = opts.channelId
19
+ this.requireColon = opts.requireColon
20
20
  this.height = opts.height || this.height
21
21
  this.format = opts.format || this.format
22
22
  }
@@ -89,20 +89,24 @@ class EmotesJS {
89
89
  for (let i = 0; i < words.length; i++) {
90
90
  let word = words[i]
91
91
 
92
- if (this.requireColon && word.startsWith(":")) {
93
- let wordKey = word.replace(':', '')
94
- let emote = this.cachedEmotes.get(wordKey)
95
92
 
96
- if (emote) {
97
- fullText += emote + ' '
98
- continue;
99
- }
93
+ if (this.requireColon && !word.startsWith(":")) {
94
+ fullText += word + " "
95
+ continue
96
+ }
97
+
98
+ let wordKey = word.replaceAll(':', '')
99
+ let emote = this.cachedEmotes.get(wordKey)
100
+
101
+ if (emote) {
102
+ fullText += emote + ' '
103
+ continue;
100
104
  }
101
105
 
102
106
  fullText += word + " "
103
107
  }
104
108
 
105
- return fullText
109
+ return fullText.trim()
106
110
  }
107
111
 
108
112
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "emotesjs",
3
3
  "description": "",
4
- "version": "0.0.14",
4
+ "version": "0.0.16",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "darckfast"