diff --git a/package.json b/package.json index c533b02..8a2cc5c 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ ], "author": "Yusuf Fauzan", "license": "MIT", + "repository": "https://github.com/iniznet/alpinejs-flux.git", "module": "dist/flux.esm.js", "unpkg": "dist/flux.min.js", "scripts": { diff --git a/src/index.js b/src/index.js index cfa8c7c..055dc9d 100644 --- a/src/index.js +++ b/src/index.js @@ -6,12 +6,10 @@ export default function ( Alpine, Config ) { Alpine.directive( "flux", ( el, { expression }, { evaluate } ) => { const arrayOrTemplateName = evaluate( expression ); - const template = - ( Array.isArray( arrayOrTemplateName ) - ? arrayOrTemplateName - : Config[arrayOrTemplateName] ) || null; + const templateName = Array.isArray( arrayOrTemplateName ) ? "" : arrayOrTemplateName; + const template = templateName ? Config[templateName] : arrayOrTemplateName; - applyTransitions( el, arrayOrTemplateName, template ); + applyTransitions( el, templateName, template ); } ).before( "transition" ); for ( const templateName of Object.keys( Config ) ) {