<commit_before>var base = require('./base');
var re = require('./re');

var A = base.A;

exports.getConstants = function(node) {
	var constants = [];

	node.body.forEach(
		function(item, index) {
			if (item.type == 'VariableDeclaration' && item.declarations) {
				item.declarations.forEach(
					function(val, key) {
						if (/^[A-Z0-9_]+$/.test(val.id.name)) {
							constants.push(val);
						}
					}
				);
			}
		}
	);

	return constants;
};

// Gets distance between the end of "left" and the start of "right"

exports.getLineDistance = function(left, right) {
	return right.loc.start.line - left.loc.end.line;
};

var compare = function(a, b) {
	var retVal = 0;

	if (a < b) {
		retVal = -1;
	}
	else if (a > b) {
		retVal = 1;
	}

	return retVal;
};

var isNumber = A.Lang.isNumber;

exports.naturalCompare = function(a, b, caseInsensitive) {
	var result = 0;

	if ((isNumber(a) && isNumber(b)) || (isNumber(+a) && isNumber(+b))) {
		result = compare(a, b);
	}
	else {
		if (caseInsensitive === true) {
			a = a.toLowerCase();
			b = b.toLowerCase();
		}

		var aa = a.split(re.REGEX_DIGITS);
		var bb = b.split(re.REGEX_DIGITS);

		var length = Math.max(aa.length, bb.length);
<commit_msg>Removing YUI from rule_utils.js<commit_after>var _ = require('lodash');
var base = require('./base');
var re = require('./re');

exports.getConstants = function(node) {
	var constants = [];

	node.body.forEach(
		function(item, index) {
			if (item.type == 'VariableDeclaration' && item.declarations) {
				item.declarations.forEach(
					function(val, key) {
						if (/^[A-Z0-9_]+$/.test(val.id.name)) {
							constants.push(val);
						}
					}
				);
			}
		}
	);

	return constants;
};

// Gets distance between the end of "left" and the start of "right"

exports.getLineDistance = function(left, right) {
	return right.loc.start.line - left.loc.end.line;
};

var compare = function(a, b) {
	var retVal = 0;

	if (a < b) {
		retVal = -1;
	}
	else if (a > b) {
		retVal = 1;
	}

	return retVal;
};

var isFinite = _.isFinite;

exports.naturalCompare = function(a, b, caseInsensitive) {
	var result = 0;

	if ((isFinite(a) && isFinite(b)) || (isFinite(+a) && isFinite(+b))) {
		result = compare(a, b);
	}
	else {
		if (caseInsensitive === true) {
			a = a.toLowerCase();
			b = b.toLowerCase();
		}

		var aa = a.split(re.REGEX_DIGITS);
		var bb = b.split(re.REGEX_DIGITS);

		var length = Math.max(aa.length, bb.length);

{'fraction_non_alphanumeric': 0.17826265953067105, 'fraction_numerical': 0.004940304652120214, 'mean_word_length': 3.05, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7103779', 'n_tokens_mistral': 1052, 'n_tokens_neox': 926, 'n_words': 206}