function _collectScaleObjectFromProps(props, attr) {
  const {
    [attr]: value,
    [`_${attr}Value`]: fallbackValue,
    [`${attr}Range`]: range,
    [`${attr}Distance`]: distance = 0,
    [`${attr}BaseValue`]: baseValue,
    [`${attr}Type`]: type = LINEAR_SCALE_TYPE,
    [`${attr}NoFallBack`]: noFallBack,
    [`get${toTitleCase(attr)}`]: accessor = d => d[attr],
    [`get${toTitleCase(attr)}0`]: accessor0 = d => d[`${attr}0`]
  } = props;

  let {[`${attr}Domain`]: domain} = props;
  // Return value-based scale if the value is assigned.
  if (!noFallBack && typeof value !== 'undefined') {
    return _createScaleObjectForValue(
      attr,
      value,
      props[`${attr}Type`],
      accessor,
      accessor0
    );
  }
  // Pick up the domain from the properties and create a new one if it's not
  // available.
  if (typeof baseValue !== 'undefined') {
    domain = addValueToArray(domain, baseValue);
  }

  // Make sure that the minimum necessary properties exist.
  if (!range || !domain || !domain.length) {
    // Try to use the fallback value if it is available.
    return _createScaleObjectForValue(
      attr,
      fallbackValue,
      props[`${attr}Type`],
      accessor,
      accessor0
    );
  }

  return _createScaleObjectForFunction({
    domain,
    range,
    type,
    distance,
    attr,
    baseValue,
    accessor,
    accessor0
  });
}
Get scale object from props. E. g. object like {xRange, xDomain, xDistance,
xType} is transformed into {range, domain, distance, type}.
@param {Object} props Props.
@param {string} attr Attribute.
@returns {*} Null or an object with the scale.
@private