Selaa lähdekoodia

improved code-readability
If type is passed then filter by type, if not then just return directives.
Also comment line has been removed - cause it's clear enough w/o it.

Parviz/Ibragim Bekliev 5 vuotta sitten
vanhempi
commit
1f9ad11d95
1 muutettua tiedostoa jossa 2 lisäystä ja 3 poistoa
  1. 2 3
      src/utils.js

+ 2 - 3
src/utils.js

@@ -110,10 +110,9 @@ export function getXAttrs(el, component, type) {
         directives = directives.concat(Object.entries(spreadObject).map(([name, value]) => parseHtmlAttribute({ name, value })))
     }
     
-    // If no type is passed in for filtering, bypass filter
-    if (!type) return directives;
+    if (type) return directives.filter(i => i.type === type)
 
-    return directives.filter(i => i.type === type)
+    return directives;
 }
 
 function parseHtmlAttribute({ name, value }) {