src/format/FeatureHash.js
function castValue_(key, value) {
  const numProperties = [
    ngeoFormatFeatureProperties.ANGLE,
    ngeoFormatFeatureProperties.OPACITY,
    ngeoFormatFeatureProperties.SIZE,
    ngeoFormatFeatureProperties.STROKE,
    'pointRadius',
    'strokeWidth'
  ];
  const boolProperties = [
    ngeoFormatFeatureProperties.IS_CIRCLE,
    ngeoFormatFeatureProperties.IS_RECTANGLE,
    ngeoFormatFeatureProperties.IS_TEXT,
    ngeoFormatFeatureProperties.SHOW_MEASURE,
    ngeoFormatFeatureProperties.SHOW_LABEL,
    'isCircle',
    'isRectangle',
    'isLabel',
    'showMeasure',
    'showLabel'
  ];

  if (numProperties.includes(key)) {
    return +value;
  } else if (boolProperties.includes(key)) {
    return (value === 'true') ? true : false;
  } else {
    return value;
  }
}
function castValue_(key, value) {
  const numProperties = [
    ngeoFormatFeatureProperties.ANGLE,
    ngeoFormatFeatureProperties.OPACITY,
    ngeoFormatFeatureProperties.SIZE,
    ngeoFormatFeatureProperties.STROKE,
    'pointRadius',
    'strokeWidth'
  ];
  const boolProperties = [
    ngeoFormatFeatureProperties.IS_CIRCLE,
    ngeoFormatFeatureProperties.IS_RECTANGLE,
    ngeoFormatFeatureProperties.IS_TEXT,
    ngeoFormatFeatureProperties.SHOW_MEASURE,
    ngeoFormatFeatureProperties.SHOW_LABEL,
    'isCircle',
    'isRectangle',
    'isLabel',
    'showMeasure',
    'showLabel'
  ];

  if (numProperties.includes(key)) {
    return +value;
  } else if (boolProperties.includes(key)) {
    return (value === 'true') ? true : false;
  } else {
    return value;
  }
}
function castValue_ ( key , value ) { const numProperties = [ ngeoFormatFeatureProperties . ANGLE , ngeoFormatFeatureProperties . OPACITY , ngeoFormatFeatureProperties . SIZE , ngeoFormatFeatureProperties . STROKE , 'pointRadius' , 'strokeWidth' ] ; const boolProperties = [ ngeoFormatFeatureProperties . IS_CIRCLE , ngeoFormatFeatureProperties . IS_RECTANGLE , ngeoFormatFeatureProperties . IS_TEXT , ngeoFormatFeatureProperties . SHOW_MEASURE , ngeoFormatFeatureProperties . SHOW_LABEL , 'isCircle' , 'isRectangle' , 'isLabel' , 'showMeasure' , 'showLabel' ] ; if ( numProperties . includes ( key ) ) { return + value ; } else if ( boolProperties . includes ( key ) ) { return ( value === 'true' ) ? true : false ; } else { return value ; } }
Cast values in the correct type depending on the property.
@param {string} key Key.
@param {string} value Value.
@return {number|boolean|string} The casted value corresponding to the key.
@private
@hidden
@hidden
Cast values in the correct type depending on the property .