<commit_before>const div = document.createElement('div');
const hasLookupFunctions = !!div.__lookupGetter__;

export default function (obj, key) {
  if (hasLookupFunctions) {
    if (obj.constructor.toString().match('Element')) {
      obj = div;
    }

    const getter = obj.__lookupGetter__(key);
    const setter = obj.__lookupSetter__(key);
    const descriptor = {
      configurable: true,
      enumerable: true
    };

    if (getter) {
      descriptor.get = function () {
        return getter.call(this);
      };
      descriptor.set = function (value) {
        setter.call(this, value);
      };
      return descriptor;
    } else if (typeof obj[key] === 'function') {
      descriptor.value = obj[key];
      return descriptor;
    }
  }

  const descriptor = Object.getOwnPropertyDescriptor(obj, key);
  if (descriptor && descriptor.get) {
    return descriptor;
  }
}<commit_msg>More robust check using instanceof.<commit_after>const div = document.createElement('div');
const hasLookupFunctions = !!div.__lookupGetter__;

export default function (obj, key) {
  if (hasLookupFunctions) {
    if (obj instanceof Node) {
      obj = div;
    }

    const getter = obj.__lookupGetter__(key);
    const setter = obj.__lookupSetter__(key);
    const descriptor = {
      configurable: true,
      enumerable: true
    };

    if (getter) {
      descriptor.get = function () {
        return getter.call(this);
      };
      descriptor.set = function (value) {
        setter.call(this, value);
      };
      return descriptor;
    } else if (typeof obj[key] === 'function') {
      descriptor.value = obj[key];
      return descriptor;
    }
  }

  const descriptor = Object.getOwnPropertyDescriptor(obj, key);
  if (descriptor && descriptor.get) {
    return descriptor;
  }
}
{'fraction_non_alphanumeric': 0.12374581939799331, 'fraction_numerical': 0.0, 'mean_word_length': 2.79492600422833, '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': '4759389', 'n_tokens_mistral': 517, 'n_tokens_neox': 513, 'n_words': 126}