<commit_before>var app = angular.module('appCommon',[]);

app.directive("viewContact", [function () {
	return {
			restrict   : "EAC",
			templateUrl: "../views/forms/view/view-contact.directive.html",
			replace    : true,
			transclude : false,
			scope: {
				document: "=ngModel",
				locale: "=",
				target: "@linkTarget"
			},
			controller: [function () {
			}]
		};
	}]);

app.directive("viewContactReference", [function () {
	return {
		restrict: "EAC",
		templateUrl: "../views/forms/view/view-contact-reference.directive.html",
		replace: true,
		transclude: false,
		scope: {
			document: "=ngModel",
			locale: "=",
			target: "@linkTarget"
		},
		controller: ["$scope", function ($scope) {

			$scope.isPerson = function() {

				var doc = $scope.document;

				if(!doc)
					return false;

				if(doc.type=="person")
					return true;

				if(!doc.type && (document.firstName || document.lastName))
					return true; //default behaviour

				return false;
			};

			$scope.isOrganization = function() {

				return !$scope.isPerson();
			};
		}]
	};
}]);

app.filter("lstring", function() {
	return lstring;
});

app.filter("yesno", function(){
	return function(boolValue){
		return boolValue ? "Yes" :  "No";
	}
});

app.filter("renderhtml", function(){
	return function(html_code){
		return html_code;
		//return $sce.trustAsHtml(html_code);
	}
});

app.filter("formatDate", function(){
	return function(date,formart){
		if(formart== undefined)
			formart = 'MMMM Do YYYY';
		return moment.utc(date).format(formart);
	}
});

app.filter("term", ["$http", function($http) {
		var cacheMap = {};

		return function(term, locale) {

			if(!term)
				return "";

			if(term && angular.isString(term))
				term = { identifier : term };

			locale = locale||"en";

			if(term.customValue)
				return lstring(term.customValue, locale);

			if(cacheMap[term.identifier])
				return lstring(cacheMap[term.identifier].title, locale) ;

			cacheMap[term.identifier] = $http.get("/api/v2013/thesaurus/terms/"+encodeURI(term.identifier),  {cache:true}).then(function(result) {

				cacheMap[term.identifier] = result.data;

				return lstring(cacheMap[term.identifier].title, locale);

			}).catch(function(){

				cacheMap[term.identifier] = term.identifier;

				return term.identifier;

			});
		};
}]);


//============================================================
//
//
//
//============================================================
app.filter("formatDate", function(){
	return function(date,formart){
		//if(formart== undefined)
			formart = 'DD MMM YYYY';
		return moment.utc(date).format(formart);
	}
});

//============================================================
//
//
//
//============================================================
app.filter("formatDateWithTime", function(){
	return function(date,formart){
		//if(formart== undefined)
			formart = 'DD MMM YYYY hh:mm a';
		return moment.utc(date).format(formart);
	}
});


function lstring(ltext, locale)
{
	if(!ltext)
		return "";

	if(angular.isString(ltext))
		return ltext;

	var sText;

	if(!sText && locale)
		sText = ltext[locale];

	if(!sText)
		sText = ltext.en;

	if(!sText) {
		for(var key in ltext) {
			sText = ltext[key];
			if(sText)
				break;
		}
	}

	return sText||"";

}
	//============================================================
	//
	//
	//
	//============================================================
	app.filter("formatDate", function(){
		return function(date,formart){
			if(formart== undefined)
				formart = 'DD MMM YYYY';
			return moment.utc(date).format(formart);
		}
	});

	//============================================================
	//
	//
	//
	//============================================================
	app.filter("formatDateWithTime", function(){
		return function(date,formart){
			if(formart== undefined)
				formart = 'DD MMM YYYY hh:mm a';
			return moment.utc(date).format(formart);
		}
	});

app.filter("uniqueID", ['$filter', '$q','$http', function( $filter, $q, $http) {
		var cacheMap = {};

		return function(term, revision) {

			if(!term)
				return "";

			var document;

			if(term && term.identifier){
				if(cacheMap[term.identifier + (revision ? '_revision':'')])
					return cacheMap[term.identifier+ (revision ? '_revision':'')] ;

				document = $http.get('/api/v2013/documents/' +  term.identifier +'?info=true');
			}
<commit_msg>udpate date to be consistent<commit_after>var app = angular.module('appCommon',[]);

app.directive("viewContact", [function () {
	return {
			restrict   : "EAC",
			templateUrl: "../views/forms/view/view-contact.directive.html",
			replace    : true,
			transclude : false,
			scope: {
				document: "=ngModel",
				locale: "=",
				target: "@linkTarget"
			},
			controller: [function () {
			}]
		};
	}]);

app.directive("viewContactReference", [function () {
	return {
		restrict: "EAC",
		templateUrl: "../views/forms/view/view-contact-reference.directive.html",
		replace: true,
		transclude: false,
		scope: {
			document: "=ngModel",
			locale: "=",
			target: "@linkTarget"
		},
		controller: ["$scope", function ($scope) {

			$scope.isPerson = function() {

				var doc = $scope.document;

				if(!doc)
					return false;

				if(doc.type=="person")
					return true;

				if(!doc.type && (document.firstName || document.lastName))
					return true; //default behaviour

				return false;
			};

			$scope.isOrganization = function() {

				return !$scope.isPerson();
			};
		}]
	};
}]);

app.filter("lstring", function() {
	return lstring;
});

app.filter("yesno", function(){
	return function(boolValue){
		return boolValue ? "Yes" :  "No";
	}
});

app.filter("renderhtml", function(){
	return function(html_code){
		return html_code;
		//return $sce.trustAsHtml(html_code);
	}
});

app.filter("formatDate", function(){
	return function(date,formart){
		if(formart== undefined)
			formart = 'MMMM Do YYYY';
		return moment.utc(date).format(formart);
	}
});

app.filter("term", ["$http", function($http) {
		var cacheMap = {};

		return function(term, locale) {

			if(!term)
				return "";

			if(term && angular.isString(term))
				term = { identifier : term };

			locale = locale||"en";

			if(term.customValue)
				return lstring(term.customValue, locale);

			if(cacheMap[term.identifier])
				return lstring(cacheMap[term.identifier].title, locale) ;

			cacheMap[term.identifier] = $http.get("/api/v2013/thesaurus/terms/"+encodeURI(term.identifier),  {cache:true}).then(function(result) {

				cacheMap[term.identifier] = result.data;

				return lstring(cacheMap[term.identifier].title, locale);

			}).catch(function(){

				cacheMap[term.identifier] = term.identifier;

				return term.identifier;

			});
		};
}]);


//============================================================
//
//
//
//============================================================
app.filter("formatDate", function(){
	return function(date,formart){
		//if(formart== undefined)
			formart = 'DD MMM YYYY';
		return moment.utc(date).format(formart);
	}
});

//============================================================
//
//
//
//============================================================
app.filter("formatDateWithTime", function(){
	return function(date,formart){
		//if(formart== undefined)
			formart = 'DD MMM YYYY hh:mm';
		return moment.utc(date).format(formart);
	}
});


function lstring(ltext, locale)
{
	if(!ltext)
		return "";

	if(angular.isString(ltext))
		return ltext;

	var sText;

	if(!sText && locale)
		sText = ltext[locale];

	if(!sText)
		sText = ltext.en;

	if(!sText) {
		for(var key in ltext) {
			sText = ltext[key];
			if(sText)
				break;
		}
	}

	return sText||"";

}
	//============================================================
	//
	//
	//
	//============================================================
	app.filter("formatDate", function(){
		return function(date,formart){
			if(formart== undefined)
				formart = 'DD MMM YYYY';
			return moment.utc(date).format(formart);
		}
	});

	//============================================================
	//
	//
	//
	//============================================================
	app.filter("formatDateWithTime", function(){
		return function(date,formart){
			if(formart== undefined)
				formart = 'DD MMM YYYY hh:mm';
			return moment.utc(date).format(formart);
		}
	});

app.filter("uniqueID", ['$filter', '$q','$http', function( $filter, $q, $http) {
		var cacheMap = {};

		return function(term, revision) {

			if(!term)
				return "";

			var document;

			if(term && term.identifier){
				if(cacheMap[term.identifier + (revision ? '_revision':'')])
					return cacheMap[term.identifier+ (revision ? '_revision':'')] ;

				document = $http.get('/api/v2013/documents/' +  term.identifier +'?info=true');
			}

{'fraction_non_alphanumeric': 0.27721417987005587, 'fraction_numerical': 0.0018237774991451043, 'mean_word_length': 3.993739328400683, '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': '7434191', 'n_tokens_mistral': 3293, 'n_tokens_neox': 2788, 'n_words': 494}