function parseDimensions(dimensions) {
  if (!dimensions) {
    return null;
  }

  return {
    width: parseFloat(dimensions.width.replace(/\s(cm|in)+$/, '')),
    height: parseFloat(dimensions.height.replace(/\s(cm|in)+$/, '')),
    unit: dimensions.width.includes('cm') ? 'CENTIMETER' : 'INCH',
  };
}
Parse the Google Books dimensions format into a proper object.

@param {string} dimensions The Google Books dimensions.
@returns A object with width and height if valid.