From 05be43ac543805d0cfd5b0e5c1f0a7ce33cf154e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 6 Feb 2021 12:54:48 +0100 Subject: [PATCH] refactoring --- docs/src/demos/Examples/Savvy/findColors.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/src/demos/Examples/Savvy/findColors.ts b/docs/src/demos/Examples/Savvy/findColors.ts index 0978598c..69d36212 100644 --- a/docs/src/demos/Examples/Savvy/findColors.ts +++ b/docs/src/demos/Examples/Savvy/findColors.ts @@ -15,15 +15,17 @@ export default function (doc: Node): DecorationSet { return } - [...node.text.matchAll(hexColor)].forEach(match => { - const index = match.index || 0 + Array + .from(node.text.matchAll(hexColor)) + .forEach(match => { + const index = match.index || 0 - results.push({ - color: match[0], - from: position + index, - to: position + index + match[0].length, + results.push({ + color: match[0], + from: position + index, + to: position + index + match[0].length, + }) }) - }) }) results.forEach(issue => {