function parseLength(len) {
  const m = unitsReg.exec(len);
  if (!m) {
    return undefined;
  }
  return Math.round(Number(m[1]) * (units[m[2]] || 1));
}
Reference: https://github.com/image-size/image-size/blob/main/lib/types/svg.ts