Selaa lähdekoodia

Get rid of spread operator

It causes crashes in Chrome 71.

https://bugs.chromium.org/p/chromium/issues/detail?id=918863
Danilo Bargen 6 vuotta sitten
vanhempi
commit
49d1b2be9f
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 1 1
      src/filters.ts
  2. 2 2
      src/services/string.ts

+ 1 - 1
src/filters.ts

@@ -158,7 +158,7 @@ angular.module('3ema.filters', [])
             if (text !== null && text.length > 10) {
                 let result = text.match(/@\[([\*\@a-zA-Z0-9][\@a-zA-Z0-9]{7})\]/g);
                 if (result !== null) {
-                    result = ([...new Set(result)]);
+                    result = new Set(result);
                     // Unique
                     for (const possibleMention of result) {
                         const identity = possibleMention.substr(2, 8);

+ 2 - 2
src/services/string.ts

@@ -17,7 +17,7 @@
 
 export class StringService {
     public byteChunk(str: string, byteLength: number, offset: number = null): string[] {
-        const chars = [...str];
+        const chars = Array.from(str);
         const chunks = [''];
         let currentChunkSize = 0;
         let chunkIndex = 0;
@@ -75,7 +75,7 @@ export class StringService {
             realLength: 0,
         };
         if (input !== null && input.length > 0) {
-            const chars = [...input];
+            const chars = Array.from(input);
             let charFound = false;
             const realPos = Math.min(pos, chars.length) - 1;