<commit_before>// normalize always returns the string in spinal-case
function normalize(str) {
	// TODO trim
	var arr = str.split(/[\s-_.]/);

	if(arr.length < 2) {
		// TODO allow other characters eg ÅÄÖ
		var matches = str.match(/([A-Z])/g);
		arr = str.split(/[A-Z]/).map(function(part, index) {
			if(index > 0) part = matches[index - 1] + part;
			
			return part.toLowerCase();
		});
		if(!arr[0]) arr.shift();
	} else
		arr = arr.map(function(part) { return part.toLowerCase(); });

	return arr;
}

function camelCase(str) {
	var arr = normalize(str);

	for(var i = 1; i < arr.length; i++) {
		arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);
	}

	return arr.join('');
}

function pascalCase(str) {
	var arr = normalize(str);

	for(var i = 0; i < arr.length; i++) {
		arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1);
	}

	return arr.join('');
}

function spinalCase(str) {
	return normalize(str).join('-');
}

function dotCase(str) {
	return normalize(str).join('.');
}

function snakeCase(str) {
	return normalize(str).join('_');
}

function spaceCase(str, capitals, divider) {
	return normalize(str).map(function(part) {
		return capitals ? part.charAt(0).toUpperCase() + part.slice(1) : part;
	}).join(' ');
}

function capitalSpaceCase(str, divider) {
	return spaceCase(str, true, divider);
}


module.exports = {
	camelCase: camelCase,
	dotCase: dotCase,
	pascalCase: pascalCase,
	spinalCase: spinalCase,
	kebabCase: spinalCase,
	snakeCase: snakeCase,
	spaceCase: spaceCase,
	capitalSpaceCase: capitalSpaceCase
};
<commit_msg>Retab and remove semi-colons.<commit_after>// normalize always returns the string in spinal-case
function normalize(str) {
  // TODO trim
  var arr = str.split(/[\s-_.]/)

  if(arr.length < 2) {
    // TODO allow other characters eg ÅÄÖ
    var matches = str.match(/([A-Z])/g)
    arr = str.split(/[A-Z]/).map(function(part, index) {
      if(index > 0) part = matches[index - 1] + part
      
      return part.toLowerCase()
    })
    if(!arr[0]) arr.shift()
  } else
    arr = arr.map(function(part) { return part.toLowerCase(); })

  return arr
}

function camelCase(str) {
  var arr = normalize(str)

  for(var i = 1; i < arr.length; i++) {
    arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1)
  }

  return arr.join('')
}

function pascalCase(str) {
  var arr = normalize(str)

  for(var i = 0; i < arr.length; i++) {
    arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].slice(1)
  }

  return arr.join('')
}

function spinalCase(str) {
  return normalize(str).join('-')
}

function dotCase(str) {
  return normalize(str).join('.')
}

function snakeCase(str) {
  return normalize(str).join('_')
}

function spaceCase(str, capitals, divider) {
  return normalize(str).map(function(part) {
    return capitals ? part.charAt(0).toUpperCase() + part.slice(1) : part
  }).join(' ')
}

function capitalSpaceCase(str, divider) {
  return spaceCase(str, true, divider)
}


module.exports = {
  camelCase: camelCase,
  dotCase: dotCase,
  pascalCase: pascalCase,
  spinalCase: spinalCase,
  kebabCase: spinalCase,
  snakeCase: snakeCase,
  spaceCase: spaceCase,
  capitalSpaceCase: capitalSpaceCase
}

{'fraction_non_alphanumeric': 0.17472353870458135, 'fraction_numerical': 0.007582938388625593, 'mean_word_length': 3.796969696969697, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '2420408', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1164, 'n_words': 255}