function getScaleFnFromScaleObject(scaleObject) {
  if (!scaleObject) {
    return null;
  }
  const {type, domain, range} = scaleObject;
  const modDomain =
    domain[0] === domain[1]
      ? domain[0] === 0
        ? [-1, 0]
        : [-domain[0], domain[0]]
      : domain;
  if (type === LITERAL_SCALE_TYPE) {
    return literalScale(range[0]);
  }
  const scale = SCALE_FUNCTIONS[type]()
    .domain(modDomain)
    .range(range);
  if (type === ORDINAL_SCALE_TYPE) {
    scale.padding(0.5);
    addInvertFunctionToOrdinalScaleObject(scale);
  }
  return scale;
}
Crate a scale function from the scale object.
@param {Object} scaleObject Scale object.
 - scaleObject.domain {Array}
 - scaleObject.range {Array}
 - scaleObject.type {string}
 - scaleObject.attr {string}
@returns {*} Scale function.
@private