@based/server
Advanced tools
Comparing version 4.5.1 to 4.5.2
@@ -135,17 +135,2 @@ "use strict"; | ||
} | ||
const getRoute = (path, name, specs) => { | ||
let rootFn; | ||
if (path) { | ||
for (const name in specs) { | ||
const fnPath = specs[name].path; | ||
if (fnPath === path) { | ||
return specs[name]; | ||
} | ||
if (!rootFn && fnPath === '/') { | ||
rootFn = specs[name]; | ||
} | ||
} | ||
} | ||
return specs[name] || rootFn || null; | ||
}; | ||
const properProps = { | ||
@@ -170,4 +155,24 @@ ...props, | ||
route: ({ server, path, name }) => { | ||
return (getRoute(path, name, functionStore) || | ||
getRoute(path, name, server.functions.specs)); | ||
let rootFn; | ||
if (path) { | ||
for (const name in functionStore) { | ||
const fnPath = functionStore[name].path; | ||
if (fnPath === path) { | ||
return functionStore[name]; | ||
} | ||
if (!rootFn && fnPath === '/') { | ||
rootFn = functionStore[name]; | ||
} | ||
} | ||
for (const name in server.functions.specs) { | ||
const fnPath = server.functions.specs[name].path; | ||
if (fnPath === path) { | ||
return server.functions.specs[name]; | ||
} | ||
if (!rootFn && fnPath === '/') { | ||
rootFn = server.functions.specs[name]; | ||
} | ||
} | ||
} | ||
return (functionStore[name] || server.functions.specs[name] || rootFn || null); | ||
}, | ||
@@ -174,0 +179,0 @@ }, |
{ | ||
"name": "@based/server", | ||
"version": "4.5.1", | ||
"version": "4.5.2", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
398504
6056