Procházet zdrojové kódy

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 před 5 roky
rodič
revize
1f9ad11d95
1 změnil soubory, kde provedl 2 přidání a 3 odebrání
  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 }) {