<commit_before>import parseEncode from '../encode';
import {FrameRole, MarkRole} from '../marks/roles';
import {array, extend, isObject} from 'vega-util';

export function encoder(_) {
  return isObject(_) ? _ : {value: _};
}

export function addEncode(object, name, value) {
  if (value != null) {
    object[name] = {value: value};<commit_msg>Update addEncode util to support object-valued input.<commit_after>import parseEncode from '../encode';
import {FrameRole, MarkRole} from '../marks/roles';
import {array, extend, isArray, isObject} from 'vega-util';

export function encoder(_) {
  return isObject(_) ? _ : {value: _};
}

export function addEncode(object, name, value) {
  if (value != null) {
    object[name] = isObject(value) && !isArray(value) ? value : {value: value};
{'fraction_non_alphanumeric': 0.15816326530612246, 'fraction_numerical': 0.0, 'mean_word_length': 4.858208955223881, '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': '4551070', 'n_tokens_mistral': 246, 'n_tokens_neox': 243, 'n_words': 73}