<commit_before>define(["dojo/_base/array"], function(arr){
	var constraints = [];
	return {
		getSelectedChild: function(view, constraint){
			// summary:
			//		get current selected child according to the constraint
			//
			// view: View
			//		the View to get the child from
			// constraint: Object
			//		tbe constraint object
			//
			// returns:
			//		the selected child view for this constraint

			return (view.selectedChildren && view.selectedChildren[constraint.__hash])?
				view.selectedChildren[constraint.__hash]:null;
		},

		setSelectedChild: function(view, constraint, child){
			// summary:
			//		set current selected child according to the constraint
			//
			// view: View
			//		the View to set the selected child to
			// constraint: Object
			//		tbe constraint object
			// child: View
			//		the child to select
			view.selectedChildren[constraint.__hash] = child;
		},

		register: function(constraint){
			// if the constraint has already been registered we don't care about it...
			if(!constraint.__hash){
				if(typeof(constraint) == "string" || typeof(constraint) == "number"){
					constraints.__index = constraint;
				}else{
					var match = null;
					arr.some(constraints, function(item){
						var ok = true;
						for(var prop in item){
							if(prop.charAt(0) !== "_"){//skip the private properties
								if(item[prop] != constraint[prop]){
									ok = false;
									break;
								}
							}
						}
						if(ok == true){
							match = constraint;
						}
						return ok;
					});
					if(match){
						constraint.__hash = match.__hash;
					}else{
						// create a new "hash"
						var hash = "";
						for(var prop in constraint){
							if(prop.charAt(0) !== "_"){
								hash += constraint[prop];
							}
						}
						constraint.__hash = hash;
					}
				}
				constraints.push(constraint);
			}
		}
	};
})<commit_msg>fix issues with string constraints<commit_after>define(["dojo/_base/array"], function(arr){
	var constraints = [];
	return {
		getSelectedChild: function(view, constraint){
			// summary:
			//		get current selected child according to the constraint
			//
			// view: View
			//		the View to get the child from
			// constraint: Object
			//		tbe constraint object
			//
			// returns:
			//		the selected child view for this constraint
			var type = typeof(constraint);
			var hash = (type == "string" ||type == "number")?constraint:constraint.__hash;
			return (view && view.selectedChildren && view.selectedChildren[hash])?
				view.selectedChildren[hash]:null;
		},

		setSelectedChild: function(view, constraint, child){
			// summary:
			//		set current selected child according to the constraint
			//
			// view: View
			//		the View to set the selected child to
			// constraint: Object
			//		tbe constraint object
			// child: View
			//		the child to select
			var type = typeof(constraint);
			var hash = (type == "string" ||type == "number")?constraint:constraint.__hash;
			view.selectedChildren[hash] = child;
		},

		register: function(constraint){
			// if the constraint has already been registered we don't care about it...
			var type = typeof(constraint);
			if(!constraint.__hash && type != "string" && type != "number"){
				var match = null;
				arr.some(constraints, function(item){
					var ok = true;
					for(var prop in item){
						if(prop.charAt(0) !== "_"){//skip the private properties
							if(item[prop] != constraint[prop]){
								ok = false;
								break;
							}
						}
					}
					if(ok == true){
						match = constraint;
					}
					return ok;
				});
				if(match){
					constraint.__hash = match.__hash;
				}else{
					// create a new "hash"
					var hash = "";
					for(var prop in constraint){
						if(prop.charAt(0) !== "_"){
							hash += constraint[prop];
						}
					}
					constraint.__hash = hash;
				}
			}
			constraints.push(constraint);
		}
	};
})
{'fraction_non_alphanumeric': 0.13463514902363824, 'fraction_numerical': 0.0010277492291880781, 'mean_word_length': 2.3940714908456844, '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': '2318175', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1132, 'n_words': 321}