<commit_before>/*
ColorGradient by <NAME> <<EMAIL>>
Released under MIT License
*/

/**
* Expects an array of objects containing a color and a position, for example:
*
*	[
*		{color: "#FF0000", position: 0.0},
*		{color: "#00FF00", position: 1.0}
*	]
*
*/
var ColorGradient = function(colors) {	
	this.colors = [];
	for (var i = colors.length - 1; i >= 0; i--) {
		this.colors[i] = {
			position: colors[i].position,
			color: parseInt(colors[i].color[0] == '#' ?
				colors[i].color.replace('#', '0x') : colors[i].color)
		};
	}
	this.colors.sort(function(a, b) { return (a.position - b.position) });
}

ColorGradient.prototype.lerpRGB = function(p, a, b) { 
	// separate R, G, B channels
	var cA = [
		(a &  0xff0000) >> 16,
		(a &  0x00ff00) >> 8,
		(a &  0x0000ff)
	];
	var cB = [
		(b &  0xff0000) >> 16,
		(b &  0x00ff00) >> 8,
		(b &  0x0000ff)
	];
	// lerp and add channels 
	var lerpInt = function(p, a, b) { 
		return Math.round(a + (b - a) * p);
	};
	return (lerpInt(p, cA[0], cB[0]) << 16)<commit_msg>Added comment<commit_after>/*
ColorGradient by <NAME> <<EMAIL>>
Released under MIT License
*/

/**
* Expects an array of objects containing a color and a position, for example:
*
*	[
*		{color: "#FF0000", position: 0.0},
*		{color: "#00FF00", position: 1.0}
*	]
*
*/
var ColorGradient = function(colors) {	
	this.colors = [];
	for (var i = colors.length - 1; i >= 0; i--) {
		this.colors[i] = {
			position: colors[i].position,
			color: parseInt(colors[i].color[0] == '#' ?
				colors[i].color.replace('#', '0x') : colors[i].color)
		};
	}
	// sort by position
	this.colors.sort(function(a, b) { return (a.position - b.position) });
}

ColorGradient.prototype.lerpRGB = function(p, a, b) { 
	// separate R, G, B channels
	var cA = [
		(a &  0xff0000) >> 16,
		(a &  0x00ff00) >> 8,
		(a &  0x0000ff)
	];
	var cB = [
		(b &  0xff0000) >> 16,
		(b &  0x00ff00) >> 8,
		(b &  0x0000ff)
	];
	// lerp and add channels 
	var lerpInt = function(p, a, b) { 
		return Math.round(a + (b - a) * p);
	};
	return (lerpInt(p, cA[0], cB[0]) << 16)
{'fraction_non_alphanumeric': 0.20537897310513448, 'fraction_numerical': 0.05476772616136919, 'mean_word_length': 3.0838323353293413, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, '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': '900285', 'n_tokens_mistral': 972, 'n_tokens_neox': 860, 'n_words': 209}