From f1d6a2e98934a4c10afe86558d5d43084722eaa4 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sun, 22 May 2022 12:47:24 +0300 Subject: [PATCH] allow single string in class names attribute --- ren/attrs.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ren/attrs.ts b/ren/attrs.ts index 77ad57d..ec86cf8 100644 --- a/ren/attrs.ts +++ b/ren/attrs.ts @@ -1,7 +1,7 @@ import { Attrs } from "../core/node.ts"; -import { isNotSkip, join, Skipable } from "../core/utils.ts"; +import { isNotSkip, isStr, join, Skipable } from "../core/utils.ts"; -export function classNames(vals: Skipable[]): Attrs { - const val = join(" ", vals.filter(isNotSkip)); +export function classNames(vals: string | Skipable[]): Attrs { + const val = isStr(vals) ? vals : join(" ", vals.filter(isNotSkip)); return !val.length ? {} : { class: val }; }