// Takes a font's name and transforms it into a Google Fonts URL. The `text`
// param loads specific letters to cut down on request size; `display=swap`
// allows a placeholder font to be shown before the real one is loaded.
function formatUrl(font, weight) {
  var fontName = font.split(" ").join("+");
  var letters = font.replaceAll("+", "").replaceAll(" ", "");
  return "https://fonts.googleapis.com/css2?text=".concat(letters, "&family=").concat(fontName, ":wght@").concat(weight, "&display=swap");
}

export { formatUrl };
