Closed zefir-git closed 1 week ago
Accept undefined/null in append() so that conditional appending is possible, without leaving the component method chain. Example:
append()
// Current beheaviour private method(foo: Component, bar: Component, baz?: Component) { const div = new Component("div") .append(foo); if (baz) div.append(baz); div.append(bar); return div; } // Proposed new behaviour private method(foo: Component, bar: Component, baz?: Component) { return new Component("div") .append(foo) .append(baz) .append(bar); }
The idea is to enable the use of:
.append(boolean ? Component : null)
Accept undefined/null in
append()
so that conditional appending is possible, without leaving the component method chain. Example:The idea is to enable the use of: