From 9ebbe5279ea6c3a160167c68f0e4d53a124ed953 Mon Sep 17 00:00:00 2001 From: David Anson Date: Mon, 12 Aug 2024 22:54:36 -0700 Subject: [PATCH] Freshen generated index.js file. --- dist/index.js | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index c7d73f4..6b94054 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6782,17 +6782,26 @@ const REPLACERS = [ [ // (a\ ) -> (a ) // (a ) -> (a) + // (a ) -> (a) // (a \ ) -> (a ) - /\\?\s+$/, - match => match.indexOf('\\') === 0 - ? SPACE - : EMPTY + /((?:\\\\)*?)(\\?\s+)$/, + (_, m1, m2) => m1 + ( + m2.indexOf('\\') === 0 + ? SPACE + : EMPTY + ) ], // replace (\ ) with ' ' + // (\ ) -> ' ' + // (\\ ) -> '\\ ' + // (\\\ ) -> '\\ ' [ - /\\\s/g, - () => SPACE + /(\\+?)\s/g, + (_, m1) => { + const {length} = m1 + return m1.slice(0, length - length % 2) + SPACE + } ], // Escape metacharacters @@ -7020,7 +7029,8 @@ const makeRegex = (pattern, ignoreCase) => { if (!source) { source = REPLACERS.reduce( - (prev, current) => prev.replace(current[0], current[1].bind(pattern)), + (prev, [matcher, replacer]) => + prev.replace(matcher, replacer.bind(pattern)), pattern ) regexCache[pattern] = source