<commit_before>import maybeThis from '../util/maybe-this';
import emit from './emit';

/* jshint expr: true */
export default maybeThis(function (elem, name, detail = {}) {
  // Notifications must *always* have:
  // - name
  // - newValue
  // - oldValue
  // but may contain other information.
  detail.name = name;
  detail.newValue === undefined && (detail.newValue = elem[name]);
  detail.oldValue === undefined && (detail.oldValue = elem[name]);

  emit(elem, [
    'skate.property',
    `skate.property.${name}`
  ], {
    detail: detail
  });
});<commit_msg>Ensure there is a new value and old value if none are explicitly specified. Not sure what the old logic was supposed to do.<commit_after>import maybeThis from '../util/maybe-this';
import emit from './emit';

/* jshint expr: true */
export default maybeThis(function (elem, name, detail = {}) {
  // Notifications must *always* have:
  // - name
  // - newValue
  // - oldValue
  // but may contain other information.
  detail.name = name;
  detail.newValue === detail.newValue === undefined ? elem[name] : detail.newValue;
  detail.oldValue === detail.oldValue === undefined ? elem[name] : detail.oldValue;

  emit(elem, [
    'skate.property',
    `skate.property.${name}`
  ], {
    detail: detail
  });
});
{'fraction_non_alphanumeric': 0.15987460815047022, 'fraction_numerical': 0.0, 'mean_word_length': 3.228476821192053, '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': '5786143', 'n_tokens_mistral': 388, 'n_tokens_neox': 390, 'n_words': 113}