summaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-preact/server.js
diff options
context:
space:
mode:
authorGravatar Jonathan Neal <jonathantneal@hotmail.com> 2021-12-22 16:11:05 -0500
committerGravatar GitHub <noreply@github.com> 2021-12-22 16:11:05 -0500
commit6ddd7678ffb6598ae6e263706813cb5e94535f02 (patch)
treed4b45f7590b59c3574bd6593b17d8066f71007c6 /packages/renderers/renderer-preact/server.js
parent305ce4182fbe89abcfb88008ddce178bd8863b6a (diff)
downloadastro-6ddd7678ffb6598ae6e263706813cb5e94535f02.tar.gz
astro-6ddd7678ffb6598ae6e263706813cb5e94535f02.tar.zst
astro-6ddd7678ffb6598ae6e263706813cb5e94535f02.zip
Use accessible indentation (#2253)
Diffstat (limited to 'packages/renderers/renderer-preact/server.js')
-rw-r--r--packages/renderers/renderer-preact/server.js38
1 files changed, 19 insertions, 19 deletions
diff --git a/packages/renderers/renderer-preact/server.js b/packages/renderers/renderer-preact/server.js
index 696217abb..25b1a1530 100644
--- a/packages/renderers/renderer-preact/server.js
+++ b/packages/renderers/renderer-preact/server.js
@@ -3,33 +3,33 @@ import render from 'preact-render-to-string';
import StaticHtml from './static-html.js';
function check(Component, props, children) {
- if (typeof Component !== 'function') return false;
+ if (typeof Component !== 'function') return false;
- if (Component.prototype != null && typeof Component.prototype.render === 'function') {
- return BaseComponent.isPrototypeOf(Component);
- }
+ if (Component.prototype != null && typeof Component.prototype.render === 'function') {
+ return BaseComponent.isPrototypeOf(Component);
+ }
- try {
- const { html } = renderToStaticMarkup(Component, props, children);
- if (typeof html !== 'string') {
- return false;
- }
+ try {
+ const { html } = renderToStaticMarkup(Component, props, children);
+ if (typeof html !== 'string') {
+ return false;
+ }
- // There are edge cases (SolidJS) where Preact *might* render a string,
- // but components would be <undefined></undefined>
+ // There are edge cases (SolidJS) where Preact *might* render a string,
+ // but components would be <undefined></undefined>
- return !/\<undefined\>/.test(html);
- } catch (err) {
- return false;
- }
+ return !/\<undefined\>/.test(html);
+ } catch (err) {
+ return false;
+ }
}
function renderToStaticMarkup(Component, props, children) {
- const html = render(h(Component, props, children != null ? h(StaticHtml, { value: children }) : children));
- return { html };
+ const html = render(h(Component, props, children != null ? h(StaticHtml, { value: children }) : children));
+ return { html };
}
export default {
- check,
- renderToStaticMarkup,
+ check,
+ renderToStaticMarkup,
};