MithrilJS / mithril-codemods

jscodeshift-powered mithril@0.2.x to mithril@1.x transformations
MIT License
19 stars 4 forks source link

m.route.set rewrite isn't safe enough #11

Closed tivac closed 8 years ago

tivac commented 8 years ago

Just look at this 🐛

 export default function() {
-    m.route(
-        document.body,
-        prefix("/setup"),
-        keys({
-            "/setup" : setup
-        }, function(value, key) {
-            return prefix(key);
-        })
-    );
+    m.route.set(document.body, prefix("/setup"), keys({
+        "/setup" : setup
+    }, function(value, key) {
+        return prefix(key);
+    }));
 }
tivac commented 8 years ago

Should probably use arity to determine the use-case and thus the transform to apply.