mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
refactor: early return (#389)
* refactor: early return Undents all the code below it 1 level. Readability win. --------- Co-authored-by: Brandon Liu <bdon@bdon.org>
This commit is contained in:
@@ -101,7 +101,10 @@ export default {
|
|||||||
|
|
||||||
const cache = caches.default;
|
const cache = caches.default;
|
||||||
|
|
||||||
if (ok) {
|
if (!ok) {
|
||||||
|
return new Response("Invalid URL", { status: 404 });
|
||||||
|
}
|
||||||
|
|
||||||
let allowedOrigin = "";
|
let allowedOrigin = "";
|
||||||
if (typeof env.ALLOWED_ORIGINS !== "undefined") {
|
if (typeof env.ALLOWED_ORIGINS !== "undefined") {
|
||||||
for (const o of env.ALLOWED_ORIGINS.split(",")) {
|
for (const o of env.ALLOWED_ORIGINS.split(",")) {
|
||||||
@@ -217,8 +220,5 @@ export default {
|
|||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return new Response("Invalid URL", { status: 404 });
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user