code: function parseAspectRatio(aspectRatio) {
    if (typeof aspectRatio !== 'string') {
      return false;
    }
    const isValidFormat = str => /^\d+(\.\d+)?:\d+(\.\d+)?$/.test(str);
    if (!isValidFormat(aspectRatio)) {
      return false;
    }
  
    const [width, height] = aspectRatio.split(':');
  
    return parseFloat(width) / parseFloat(height);
  }
docs: Parse an aspect ratio in the format w:h to a decimal. If false is returned, the aspect ratio is in the wrong format.