diff --git a/lib/fixer.js b/lib/fixer.js index 49b97f5e322e7acbd040806e04627cd1f1321915..c747f7cdea7afe2ac753514e3b37724a19e48cb4 100644 --- a/lib/fixer.js +++ b/lib/fixer.js @@ -10,6 +10,16 @@ var typos = require('./typos.json') var isEmail = str => str.includes('@') && (str.indexOf('@') < str.lastIndexOf('.')) +// polyfill until support for node <18.17.0 is dropped +URL.canParse ??= (input, base) => { + try { + new URL(input, base); + return true; + } catch { + return false; + } +} + module.exports = { // default warning function warn: function () {},