Manual Reference Source Test

src/models/flow/FlowKeyValue.js

import { stringToCamel } from '../../utilities/FormatUtility';

/**
 * This is only used as an alias to simplify the saving of flow information.  Real saving occurs from a captured value group.
 */
class FlowKeyValueModel {
  /**
     * @param {Object}  response              - JSON formatted response of an entry.
     * @param {String}  response.id           - The entry id value
     * @param {Object}  response.attributes   - Any number of key/value relationships
     */
  constructor(response = {}) {
    const _response = response.data || response; // if json api is passed in directly
    const attributes = _response.attributes || _response; // if json api is passed in directly

    if (_response.id) {
      /** @type {String} */
      this.id = _response.id;
    }

    // Object.assign(this, attributes);
    Object.keys(attributes).forEach((key) => {
      /** @type {Any} */
      this[stringToCamel(key)] = attributes[key];
    });
  }
}

export default FlowKeyValueModel;