<commit_before>/**
 * @param {number[]} nums
 * @return {boolean}
 */
var containsDuplicate = function(nums) {
  var hash = {};

  return nums.some(function (val) {
    if (hash[val]) return true;
    hash[val] = 1;
  });
};


var eq = require('assert').equal;

eq(containsDuplicate([1,2,3]), false);
eq(containsDuplicate([1,2,1]), true);
eq(containsDuplicate([]), false);<commit_msg>Contains Duplicate: use Set<commit_after>/**
 * @param {number[]} nums
 * @return {boolean}
 */
// use some
var containsDuplicate = function(nums) {
  var hash = {};

  return nums.some(function (val) {
    if (hash[val]) return true;
    hash[val] = 1;
  });
};

var containsDuplicate = function(nums) {
  return nums.length > (new Set(nums)).size;
};


var eq = require('assert').equal;

eq(containsDuplicate([1,2,3]), false);
eq(containsDuplicate([1,2,1]), true);
eq(containsDuplicate([]), false);
{'fraction_non_alphanumeric': 0.2002262443438914, 'fraction_numerical': 0.01583710407239819, 'mean_word_length': 4.709677419354839, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7209301', 'n_tokens_mistral': 320, 'n_tokens_neox': 313, 'n_words': 69}