From 68b1fab3698ab74af9c49f995b712868a491be15 Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 12 Jun 2020 15:32:30 +0200 Subject: [PATCH] matchAll -> exec loop --- docs/content/.vuepress/components/Cmd.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/content/.vuepress/components/Cmd.vue b/docs/content/.vuepress/components/Cmd.vue index e324aacf..0fd24ef6 100644 --- a/docs/content/.vuepress/components/Cmd.vue +++ b/docs/content/.vuepress/components/Cmd.vue @@ -70,7 +70,10 @@ const parts = []; let lastMatch = 0; - for (const match of usage.matchAll(/`([^`]+)`/g)) { + // matchAll isn't common yet, using exec :( + const re = /`([^`]+)`/g; + let match; + while (match = re.exec(usage)) { if (match.index > 0) parts.push({type: "str", str: usage.substring(lastMatch, match.index)}); parts.push({type: "arg", arg: match[1]});