<commit_before>import {eventExpression, handlerExpression} from './expression';
import parseParameters from './parameters';
import {error} from 'vega-util';

/**
 * Parse an event-driven operator update.
 */
export default function(spec, ctx) {
  var source = ctx.get(spec.source),
      target = null,
      update = spec.update,
      params = undefined;

  if (!source) error('Source not defined: ' + spec.source);

  if (spec.target && spec.target.$expr) {
    target = eventExpression(spec.target.$expr, ctx);
  } else {
    target = ctx.get(spec.target);
  }

  if (update && update.$expr) {
    if (update.$params) {<commit_msg>Add support for object as event update source.<commit_after>import {eventExpression, handlerExpression} from './expression';
import parseParameters from './parameters';
import {error, isObject} from 'vega-util';

/**
 * Parse an event-driven operator update.
 */
export default function(spec, ctx) {
  var srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,
      source = ctx.get(srcid),
      target = null,
      update = spec.update,
      params = undefined;

  if (!source) error('Source not defined: ' + spec.source);

  if (spec.target && spec.target.$expr) {
    target = eventExpression(spec.target.$expr, ctx);
  } else {
    target = ctx.get(spec.target);
  }

  if (update && update.$expr) {
    if (update.$params) {
{'fraction_non_alphanumeric': 0.14785142024763293, 'fraction_numerical': 0.0, 'mean_word_length': 3.4901960784313726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5268315', 'n_tokens_mistral': 412, 'n_tokens_neox': 405, 'n_words': 115}