Rename empty to nothing
This commit is contained in:
parent
20281280ab
commit
649fd197d8
1 changed files with 3 additions and 3 deletions
|
@ -19,7 +19,7 @@ class MultiAbortController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A symbol representing nothing to be appended to an element */
|
/** A symbol representing nothing to be appended to an element */
|
||||||
export const empty = Symbol("Explicit empty argument for Nyooom")
|
export const nothing = Symbol("Explicit non-argument for Nyooom")
|
||||||
|
|
||||||
/** Converts a snake-case string to a CSS property name
|
/** Converts a snake-case string to a CSS property name
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
|
@ -137,7 +137,7 @@ export class DomRenderer extends Renderer {
|
||||||
* @param {Array} args
|
* @param {Array} args
|
||||||
*/
|
*/
|
||||||
static apply(element, ...args) {
|
static apply(element, ...args) {
|
||||||
for (const arg of args) if (arg !== empty) {
|
for (const arg of args) if (arg !== nothing) {
|
||||||
if (Array.isArray(arg)) {
|
if (Array.isArray(arg)) {
|
||||||
this.apply(element, ...arg)
|
this.apply(element, ...arg)
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,7 +145,7 @@ export class DomRenderer extends Renderer {
|
||||||
if (child)
|
if (child)
|
||||||
element.append(child)
|
element.append(child)
|
||||||
else if (typeof arg == "function")
|
else if (typeof arg == "function")
|
||||||
this.apply(element, arg(element) || empty)
|
this.apply(element, arg(element) || nothing)
|
||||||
else if (arg instanceof DocumentFragment)
|
else if (arg instanceof DocumentFragment)
|
||||||
element.append(arg)
|
element.append(arg)
|
||||||
else if (arg && typeof(arg)=="object")
|
else if (arg && typeof(arg)=="object")
|
||||||
|
|
Loading…
Reference in a new issue