src/language-handlebars/printer-glimmer.js/locationToOffset
function locationToOffset(source, line, column) {
  let seenLines = 0;
  let seenChars = 0;

  // eslint-disable-next-line no-constant-condition
  while (true) {
    if (seenChars === source.length) {
      return null;
    }

    let nextLine = source.indexOf("\n", seenChars);
    if (nextLine === -1) {
      nextLine = source.length;
    }

    if (seenLines === line) {
      if (seenChars + column > nextLine) {
        return null;
      }
      return seenChars + column;
    } else if (nextLine === -1) {
      return null;
    }
    seenLines += 1;
    seenChars = nextLine + 1;
  }
}