diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-12-30 15:14:36 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-12-30 15:49:11 -0400 |
commit | 01dcd2fcc4d8bde2458258c94b317e114c1f9756 (patch) | |
tree | 3f477e1c1ce1ffa9e4b90582d3b964b496cd1bd5 /src/util | |
parent | 9bde2140700ab243ace40b959784f2338283ef9c (diff) |
html: make isTag and isTemplate proper validators
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/html.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/util/html.js b/src/util/html.js index 0c29ecd1..32350236 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -6,6 +6,10 @@ import {colors} from '#cli'; import {empty, typeAppearance} from '#sugar'; import * as commonValidators from '#validators'; +const { + validateInstanceOf, +} = commonValidators; + // COMPREHENSIVE! // https://html.spec.whatwg.org/multipage/syntax.html#void-elements export const selfClosingTags = [ @@ -72,14 +76,6 @@ export function isBlank(value) { return value.length === 0; } -export function isTag(value) { - return value instanceof Tag; -} - -export function isTemplate(value) { - return value instanceof Template; -} - export function isHTML(value) { if (typeof value === 'string') { return true; @@ -1238,3 +1234,9 @@ export class Stationery { : `Stationery ${colors.dim(`(no annotation)`)}`)); } } + +export const isTag = + validateInstanceOf(Tag); + +export const isTemplate = + validateInstanceOf(Template); |