toggle-components-library 1.22.6 → 1.22.7

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/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.22.6",
3
+ "version": "1.22.7",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.22.6",
3
+ "version": "1.22.7",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -140,60 +140,6 @@ export default {
140
140
  return mcount+' / '+maxLenght;
141
141
  },
142
142
 
143
- /*
144
- * Converts emojis to html entity
145
- * @param str (the entire message)
146
- * @return string of entire message including decoded emojis
147
- */
148
- convertEmojis(str) {
149
-
150
- let result = '';
151
-
152
- //converts unicode decimal value into an HTML entity
153
- let decimal2Html = (num) => `&#${num};`;
154
-
155
- //converts a character into an HTML entity
156
- const char2Html = (char) => {
157
- let item = `${char}`;
158
-
159
- //spread operator can detect emoji surrogate pairs
160
- if([...item].length > 1) {
161
-
162
- //handle and convert utf surrogate pairs
163
- let concat = '';
164
- let unicode = '';
165
-
166
- //for each part of the pair
167
- for(let i = 0; i < 2; i++){
168
-
169
- //get the character code value
170
- let dec = char[i].charCodeAt();
171
- //convert to binary
172
- let bin = dec.toString(2);
173
- //take the last 10 bits
174
- let last10 = bin.slice(-10);
175
- //concatenate into 20 bit binary
176
- concat = concat + last10;
177
- //add 0x10000 to get unicode value
178
- unicode = parseInt(concat,2) + 0x10000;
179
- }
180
-
181
- //html entity from unicode value
182
- return decimal2Html(unicode);
183
- }
184
-
185
- //ASCII character or html entity from character code
186
- return char.charCodeAt() > 127 ? decimal2Html(char.charCodeAt()) : char;
187
- };
188
-
189
- //check each character
190
- [...str].forEach(char=>{
191
- result += char2Html(char);
192
- });
193
-
194
- return result;
195
- },
196
-
197
143
  onFocus() {
198
144
  this.$emit('onFocus');
199
145
  },
@@ -44,5 +44,59 @@ export const mixins = {
44
44
 
45
45
  },
46
46
 
47
+ /*
48
+ * Converts emojis to html entity
49
+ * @param str (the entire message)
50
+ * @return string of entire message including decoded emojis
51
+ */
52
+ convertEmojis(str) {
53
+
54
+ let result = '';
55
+
56
+ //converts unicode decimal value into an HTML entity
57
+ let decimal2Html = (num) => `&#${num};`;
58
+
59
+ //converts a character into an HTML entity
60
+ const char2Html = (char) => {
61
+ let item = `${char}`;
62
+
63
+ //spread operator can detect emoji surrogate pairs
64
+ if([...item].length > 1) {
65
+
66
+ //handle and convert utf surrogate pairs
67
+ let concat = '';
68
+ let unicode = '';
69
+
70
+ //for each part of the pair
71
+ for(let i = 0; i < 2; i++){
72
+
73
+ //get the character code value
74
+ let dec = char[i].codePointAt();
75
+ //convert to binary
76
+ let bin = dec.toString(2);
77
+ //take the last 10 bits
78
+ let last10 = bin.slice(-10);
79
+ //concatenate into 20 bit binary
80
+ concat = concat + last10;
81
+ //add 0x10000 to get unicode value
82
+ unicode = parseInt(concat,2) + 0x10000;
83
+ }
84
+
85
+ //html entity from unicode value
86
+ return decimal2Html(unicode);
87
+ }
88
+
89
+ //ASCII character or html entity from character code
90
+ return char.codePointAt() > 127 ? decimal2Html(char.codePointAt()) : char;
91
+ };
92
+
93
+ //check each character
94
+ [...str].forEach(char=>{
95
+ result += char2Html(char);
96
+ });
97
+
98
+ return result;
99
+ },
100
+
47
101
  }
48
102
  }