From a7dd227336bee09f2aa365ad2fe00e4b5c405c6a Mon Sep 17 00:00:00 2001 From: Luca Bonavita Date: Sat, 22 Jun 2019 17:42:00 +0100 Subject: [PATCH] Docs: document rest in array/object destructuring in each blocks (#2676) --- site/content/docs/02-template-syntax.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/site/content/docs/02-template-syntax.md b/site/content/docs/02-template-syntax.md index a6e17f8bc2..aabcf1f2f3 100644 --- a/site/content/docs/02-template-syntax.md +++ b/site/content/docs/02-template-syntax.md @@ -188,12 +188,20 @@ If a *key* expression is provided — which must uniquely identify each list ite --- -You can freely use destructuring patterns in each blocks. +You can freely use destructuring and rest patterns in each blocks. ```html {#each items as { id, name, qty }, i (id)}
  • {i + 1}: {name} x {qty}
  • {/each} + +{#each objects as { id, ...rest }} +
  • {id}
  • +{/each} + +{#each items as [id, ...rest]} +
  • {id}
  • +{/each} ``` ---