<commit_before>module.exports=dataset;

/*global document*/

var fn;

if (document.body.dataset) {
  fn = {
    set: function(node, attr, value) {
      node.dataset[attr] = value;
    },
    get: function(node, attr) {
      return node.dataset[attr];
    }
  };
} else {
  fn = {
    set: function(node, attr, value) {
      node.setAttribute('data-' + attr, value);
    },
    get: function(node, attr) {
      return node.getAttribute('data-' + attr);
    }
  };
}

function dataset(node, attr, value) {
  if (arguments.length === 3) {
    fn.set(node, attr, value);
  } else {
    return fn.get(node, attr);
  }<commit_msg>Chainable set API<commit_after>module.exports=dataset;

/*global document*/

var fn;

if (document.body.dataset) {
  fn = {
    set: function(node, attr, value) {
      node.dataset[attr] = value;
    },
    get: function(node, attr) {
      return node.dataset[attr];
    }
  };
} else {
  fn = {
    set: function(node, attr, value) {
      node.setAttribute('data-' + attr, value);
    },
    get: function(node, attr) {
      return node.getAttribute('data-' + attr);
    }
  };
}

function dataset(node, attr, value) {
  var self = {
    set: set,
    get: get
  };

  function set(attr, value) {
    fn.set(node, attr, value);
    return self;
  }

  function get(attr) {
    return fn.get(node, attr);
  }

  if (arguments.length === 3) {
    return set(attr, value);
  }
  if (arguments.length == 2) {
    return get(attr);
  }

  return self;
{'fraction_non_alphanumeric': 0.1649763353617309, 'fraction_numerical': 0.002028397565922921, 'mean_word_length': 2.57487922705314, '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': '2662497', 'n_tokens_mistral': 528, 'n_tokens_neox': 519, 'n_words': 120}