<commit_before>﻿// uses typings/angularjs
// Formats and optionally truncates and ellipsimogrifies a string for display in a card header

/// <reference path='../object/object.service.ts' />

module rl.utilities.truncate {
	'use strict';
	
	export var moduleName: string = 'rl21.components.truncate';
	export var serviceName: string = 'truncate';
	export var filterName: string = name + 'Filter'; 
	

	export interface ITruncateFilter {
		(input?: string, truncateTo?: number, includeEllipses?: boolean): string;
		(input?: number, truncateTo?: number, includeEllipses?: boolean): string;
	}
	
	truncate.$inject = [object.serviceName]
	export function truncate(objectUtility: object.IObjectUtility): ITruncateFilter {
		'use strict';
		return (input?: any, truncateTo?: number, includeEllipses?: boolean): string => {
			includeEllipses = includeEllipses == null ? false : includeEllipses;
	
			var out: string = objectUtility.isNullOrWhitespace(input) ? '' : input.toString();
			if (out.length) {
				if (truncateTo != null && out.length > truncateTo) {
					out = out.substring(0, truncateTo);<commit_msg>filterName should be serviceName + 'filter'<commit_after>﻿// uses typings/angularjs
// Formats and optionally truncates and ellipsimogrifies a string for display in a card header

/// <reference path='../object/object.service.ts' />

module rl.utilities.truncate {
	'use strict';
	
	export var moduleName: string = 'rl21.components.truncate';
	export var serviceName: string = 'truncate';
	export var filterName: string = serviceName + 'Filter'; 
	

	export interface ITruncateFilter {
		(input?: string, truncateTo?: number, includeEllipses?: boolean): string;
		(input?: number, truncateTo?: number, includeEllipses?: boolean): string;
	}
	
	truncate.$inject = [object.serviceName]
	export function truncate(objectUtility: object.IObjectUtility): ITruncateFilter {
		'use strict';
		return (input?: any, truncateTo?: number, includeEllipses?: boolean): string => {
			includeEllipses = includeEllipses == null ? false : includeEllipses;
	
			var out: string = objectUtility.isNullOrWhitespace(input) ? '' : input.toString();
			if (out.length) {
				if (truncateTo != null && out.length > truncateTo) {
					out = out.substring(0, truncateTo);
{'fraction_non_alphanumeric': 0.12649800266311584, 'fraction_numerical': 0.002663115845539281, 'mean_word_length': 4.75, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5772043', 'n_tokens_mistral': 751, 'n_tokens_neox': 678, 'n_words': 189}