summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts')
-rw-r--r--chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts b/chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts
new file mode 100644
index 00000000000..4091177ac4b
--- /dev/null
+++ b/chromium/third_party/node/node_modules/lit-html/directives/choose.d.ts
@@ -0,0 +1,32 @@
+/**
+ * @license
+ * Copyright 2021 Google LLC
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+/**
+ * Chooses and evaluates a template function from a list based on matching
+ * the given `value` to a case.
+ *
+ * Cases are structured as `[caseValue, func]`. `value` is matched to
+ * `caseValue` by strict equality. The first match is selected. Case values
+ * can be of any type including primitives, objects, and symbols.
+ *
+ * This is similar to a switch statement, but as an expression and without
+ * fallthrough.
+ *
+ * @example
+ *
+ * ```ts
+ * render() {
+ * return html`
+ * ${choose(this.section, [
+ * ['home', () => html`<h1>Home</h1>`],
+ * ['about', () => html`<h1>About</h1>`]
+ * ],
+ * () => html`<h1>Error</h1>`)}
+ * `;
+ * }
+ * ```
+ */
+export declare const choose: <T, V, K extends T = T>(value: T, cases: [K, () => V][], defaultCase?: (() => V) | undefined) => V | undefined;
+//# sourceMappingURL=choose.d.ts.map \ No newline at end of file