Verified Commit 0819b7aa authored by Théodore Biadala's avatar Théodore Biadala
Browse files

Issue #3454079 by Tom Konda, smustgrave: Prefer to use...

Issue #3454079 by Tom Konda, smustgrave: Prefer to use Array.prototype.includes() for some of Array.prototype.indexOf()
parent 9ad6e113
Loading
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -112,9 +112,8 @@
      const tagged = autocomplete.splitValues(request.term);
      const il = tagged.length;
      for (let i = 0; i < il; i++) {
        const index = suggestions.indexOf(tagged[i]);
        if (index >= 0) {
          suggestions.splice(index, 1);
        if (suggestions.includes(tagged[i])) {
          suggestions.splice(suggestions.indexOf(tagged[i]), 1);
        }
      }
      response(suggestions);
+3 −4
Original line number Diff line number Diff line
@@ -326,15 +326,14 @@
        const id = e.currentTarget.value;

        // Update the selection.
        const position = currentSelection.indexOf(id);
        if (e.currentTarget.checked) {
          // Check if the ID is not already in the selection and add if needed.
          if (position === -1) {
          if (!currentSelection.includes(id)) {
            currentSelection.push(id);
          }
        } else if (position !== -1) {
        } else if (currentSelection.includes(id)) {
          // Remove the ID when it is in the current selection.
          currentSelection.splice(position, 1);
          currentSelection.splice(currentSelection.indexOf(id), 1);
        }

        const mediaLibraryModalSelection = document.querySelector(
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
    messageWrapper.setAttribute('data-drupal-message-type', type);
    let svg = '';

    if (['error', 'warning', 'status', 'info'].indexOf(type) > -1) {
    if (['error', 'warning', 'status', 'info'].includes(type)) {
      svg =
        '<div class="messages__icon"><svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">';
    }
@@ -58,7 +58,7 @@
        '<path d="M32,16c0,8.8-7.2,16-16,16S0,24.8,0,16C0,7.2,7.2,0,16,0S32,7.2,32,16z M16.4,5.3c-3.5,0-5.8,1.5-7.5,4.1c-0.2,0.3-0.2,0.8,0.2,1l2.2,1.7c0.3,0.3,0.8,0.2,1.1-0.1c1.2-1.5,1.9-2.3,3.7-2.3c1.3,0,2.9,0.8,2.9,2.1c0,1-0.8,1.5-2.1,2.2c-1.5,0.9-3.5,1.9-3.5,4.6v0.3c0,0.4,0.3,0.8,0.8,0.8h3.6c0.4,0,0.8-0.3,0.8-0.8v-0.1c0-1.8,5.4-1.9,5.4-6.9C23.9,8.1,20.1,5.3,16.4,5.3z M16,21.3c-1.6,0-3,1.3-3,3c0,1.6,1.3,3,3,3s3-1.3,3-3C19,22.6,17.6,21.3,16,21.3z"/>';
    }

    if (['error', 'warning', 'status', 'info'].indexOf(type) > -1) {
    if (['error', 'warning', 'status', 'info'].includes(type)) {
      svg += '</svg></div>';
    }