From 003f594f6348b55109dd66416e75fcc2a88faade Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 26 Nov 2022 23:44:08 -0400 Subject: finish up cosmetic style changes --- src/util/html.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/util/html.js') diff --git a/src/util/html.js b/src/util/html.js index 752291e9..0a586223 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -1,5 +1,3 @@ -/** @format */ - // Some really simple functions for formatting HTML content. // COMPREHENSIVE! @@ -116,16 +114,18 @@ export function escapeAttributeValue(value) { export function attributes(attribs) { return Object.entries(attribs) .map(([key, val]) => { - if (typeof val === 'undefined' || val === null) return [key, val, false]; - else if (typeof val === 'string') return [key, val, true]; - else if (typeof val === 'boolean') return [key, val, val]; - else if (typeof val === 'number') return [key, val.toString(), true]; + if (typeof val === 'undefined' || val === null) + return [key, val, false]; + else if (typeof val === 'string') + return [key, val, true]; + else if (typeof val === 'boolean') + return [key, val, val]; + else if (typeof val === 'number') + return [key, val.toString(), true]; else if (Array.isArray(val)) return [key, val.filter(Boolean).join(' '), val.length > 0]; else - throw new Error( - `Attribute value for ${key} should be primitive or array, got ${typeof val}` - ); + throw new Error(`Attribute value for ${key} should be primitive or array, got ${typeof val}`); }) .filter(([_key, _val, keep]) => keep) .map(([key, val]) => -- cgit 1.3.0-6-gf8a5