processValues(values) {
    let newValues = [];
    if (!values || !values.length) {
      return newValues;
    }

    if (this.props.type === 'string') {
      values.map((string) => {
        newValues.push({
          value: string,
          key: String(Math.random()),
        });
      });
    } else {
      // input array contains objects,
      // each field is a separate object
      const { fields } = this.props;
      if (fields.length) {
        values.map((obj) => {
          fields.map((field) => {
            newValues.push({
              value: obj[field],
              key: obj.id || String(Math.random()),
            });
          });
        });
      }
    }
    return newValues;
  }
/**
   * Returns an arary of objects to pass onto renderer.
   * Each object has 'key' and 'value' properties.
   *
   * @param {Array} values An array of either strings or objects.
   * @returns {Array} An array of fields to render, with
   * key and value properties.
   */
Returns an arary of objects to pass onto renderer.
Each object has 'key' and 'value' properties.

@param {Array} values An array of either strings or objects.
@returns {Array} An array of fields to render, with
key and value properties.
Returns an arary of objects to pass onto renderer . Each object has ' key ' and ' value ' properties . @param { Array } values An array of either strings or objects . @returns { Array } An array of fields to render with key and value properties .
processValues(values) {
    let newValues = [];
    if (!values || !values.length) {
      return newValues;
    }
    if (this.props.type === 'string') {
      values.map((string) => {
        newValues.push({
          value: string,
          key: String(Math.random()),
        });
      });
    } else {
      const { fields } = this.props;
      if (fields.length) {
        values.map((obj) => {
          fields.map((field) => {
            newValues.push({
              value: obj[field],
              key: obj.id || String(Math.random()),
            });
          });
        });
      }
    }
    return newValues;
  }
processValues ( values ) { let newValues = [ ] ; if ( ! values || ! values . length ) { return newValues ; } if ( this . props . type === 'string' ) { values . map ( ( string ) => { newValues . push ( { value : string , key : String ( Math . random ( ) ) , } ) ; } ) ; } else { const { fields } = this . props ; if ( fields . length ) { values . map ( ( obj ) => { fields . map ( ( field ) => { newValues . push ( { value : obj [ field ] , key : obj . id || String ( Math . random ( ) ) , } ) ; } ) ; } ) ; } } return newValues ; }
Returns an arary of objects to pass onto renderer.
Returns an arary of objects to pass onto renderer .
// input array contains objects, // each field is a separate object