<commit_before>'use strict';
var debug    = require('debug')('soundcloud/user');
var filter   = require('lodash.filter');
var is       = require('is_js');
var _request = require('./request');

var getUserByName = function(clientId, name) {
  var limit = 100;
  var offset = 0;
  var regex = new RegExp('/' + name + '$', 'g');
  debug(regex, clientId);

  function getUser(scName) {
  return _request('resolve', {
    url: 'http://soundcloud.com/' + scName,
    client_id: clientId,
  })
  .then(function(response) {
    debug('response', response);
    if (response.errors) {
      throw new Error(response.errors);
    }
    return response;
  });
}

  return getUser(name);
};

var getUserById = function(clientId, id) {
  return _request('users/' + id + '.json', {
    client_id: clientId
  })
  .then(function(results){
    if (results.errors) {
        throw results.errors;
    }
    return results;
  });
};

var SoundCloudUser = function(clientId, name) {
  this.clientId = clientId;

  if (is.number(name)) {
    this.user = getUserById(clientId, name);
  } else {
    this.user = getUserByName(clientId, name);
  }

  this.getUserInfo = function(type, params) {
    var self = this;
    return this.user
      .then(function(user) {
        debug(user);<commit_msg>removed unused variables<commit_after>'use strict';
var debug    = require('debug')('soundcloud/user');
var filter   = require('lodash.filter');
var is       = require('is_js');
var _request = require('./request');

var getUserByName = function(clientId, name) {
  return _request('resolve', {
    url: 'http://soundcloud.com/' + name,
    client_id: clientId,
  })
  .then(function(response) {
    debug('response', response);
    if (response.errors) {
      throw new Error(response.errors);
    }
    return response;
  });
};

var getUserById = function(clientId, id) {
  return _request('users/' + id + '.json', {
    client_id: clientId
  })
  .then(function(results){
    if (results.errors) {
        throw results.errors;
    }
    return results;
  });
};

var SoundCloudUser = function(clientId, name) {
  this.clientId = clientId;

  if (is.number(name)) {
    this.user = getUserById(clientId, name);
  } else {
    this.user = getUserByName(clientId, name);
  }

  this.getUserInfo = function(type, params) {
    var self = this;
    return this.user
      .then(function(user) {
        debug(user);
{'fraction_non_alphanumeric': 0.15564853556485356, 'fraction_numerical': 0.0016736401673640166, 'mean_word_length': 3.209507042253521, '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': '1939752', 'n_tokens_mistral': 789, 'n_tokens_neox': 781, 'n_words': 173}