From 3294b27029088ea126d34b9a52b09f255140ff29 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sat, 8 Jan 2022 00:22:21 +0000 Subject: [PATCH] add replaceAll polyfill --- scripts/missing-colors.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/missing-colors.js b/scripts/missing-colors.js index cc11090..09c646c 100644 --- a/scripts/missing-colors.js +++ b/scripts/missing-colors.js @@ -13,6 +13,11 @@ const hasDark = (item) => { return false; }; +if (typeof String.prototype.replaceAll === "undefined") { + String.prototype.replaceAll = function(match, replace) { + return this.replace(new RegExp(match, 'g'), () => replace); + } +} function fixHTML(infile, outfile) { let f = fs.readFileSync(infile).toString();