<commit_before>/* jslint node: true */

'use strict';

var _ = require('lodash');

var defaults = {
  loop: false,
  play: false,
  playbackRate: 1,
  quality: 1,
  volume: 1,
};

function Player(p) {
  var player = {};

  switch (typeof p) {
    case 'object':
      this.id = p.id || _.uniqueId();
      player = p;
      break;
    case 'undefined':
      this.id = _.uniqueId();
      break;
    default:
      this.id = p;
  }

  this.loop = player.loop || defaults.loop;
  this.play = player.play || defaults.play;
  this.playbackRate = player.playbackRate || defaults.playbackRate;
  this.quality = player.quality || defaults.quality;
  this.volume = player.volume || defaults.volume;
}

module.exports = Player;<commit_msg>handle an object to simplify<commit_after>/* jslint node: true */

'use strict';

var _ = require('lodash');

var defaults = {
  loop: false,
  play: false,
  playbackRate: 1,
  quality: 1,
  volume: 1
};

function Player(p) {
  var player = {};

  switch (typeof p) {
    case 'object':
      player = p;
      player.id = p.id || _.uniqueId();
      break;
    case 'undefined':
      player.id = _.uniqueId();
      break;
    default:
      player.id = p;
  }

  return _.defaults(player, defaults);
}

module.exports = Player;
{'fraction_non_alphanumeric': 0.14976228209191758, 'fraction_numerical': 0.004754358161648178, 'mean_word_length': 2.6608695652173915, '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': '3491729', 'n_tokens_mistral': 441, 'n_tokens_neox': 426, 'n_words': 111}