<commit_before>( function() {
	
	var Backstab = this.Backstab;
	
	// helpers
	var factorySetup = function( setupRes, opts, setupParams ) {
		
		var setupOpts = $.extend( {
			params: {},
			extend: {}
		}, opts );
		
		// auto-stuff
		setupRes = setupParams( setupRes, setupOpts.params );
		
		// extend events if it exists
		if ( setupRes.events && setupOpts.extend.events ) {
			setupRes.events = $.extend(
				setupRes.events,
				setupOpts.extend.events
			);
			delete setupOpts.extend.events;
		}
		
		// extend the rest
		setupRes = $.extend( setupRes, setupOpts.extend );
		
		return setupRes;
	}
	
	//
	Backstab.factory = function( options ) {
		
		var opts = $.extend( {
			script: {},
			model: {},
			collection: {},
			itemView: {},
			listView: {}
		}, options );
		
		if ( !opts.name_plural ) {
			opts.name_plural = opts.name + 's';
		}
		
		var ent = {};
		
		
		
		// --- model -------------------------------------------------------------------------------
		
		if ( false !== opts.model ) {
			
			var mdPrms = $.extend( {}, opts.model.params );
			
			var modelExt = {};
			
			modelExt = factorySetup( modelExt, opts.model, function( ext, params ) {
				
				if ( params.autourl ) {
					ext.url = opts.script.ajax_content + '&section=' + opts.name;
				}
				
				return ext;
				
			} );
			
			ent.Model = Backstab.Model.extend( modelExt );			
		}
		
		
		
		
		// --- collection --------------------------------------------------------------------------
		
		if ( false !== opts.collection ) {
		
			var clPrms = $.extend( {}, opts.collection.params );
			
			var collectionExt = { model: ent.Model };
			
			collectionExt = factorySetup( collectionExt, opts.collection, function( ext, params ) {
				
				if ( params.autourl ) {
					ext.url = opts.script.ajax_content + '&section=' + opts.name_plural;
				}
				
				return ext;<commit_msg>Added "parseinfo" param to factory/collection<commit_after>( function() {
	
	var Backstab = this.Backstab;
	
	// helpers
	var factorySetup = function( setupRes, opts, setupParams ) {
		
		var setupOpts = $.extend( {
			params: {},
			extend: {}
		}, opts );
		
		// auto-stuff
		setupRes = setupParams( setupRes, setupOpts.params );
		
		// extend events if it exists
		if ( setupRes.events && setupOpts.extend.events ) {
			setupRes.events = $.extend(
				setupRes.events,
				setupOpts.extend.events
			);
			delete setupOpts.extend.events;
		}
		
		// extend the rest
		setupRes = $.extend( setupRes, setupOpts.extend );
		
		return setupRes;
	}
	
	//
	Backstab.factory = function( options ) {
		
		var opts = $.extend( {
			script: {},
			model: {},
			collection: {},
			itemView: {},
			listView: {}
		}, options );
		
		if ( !opts.name_plural ) {
			opts.name_plural = opts.name + 's';
		}
		
		var ent = {};
		
		
		
		// --- model -------------------------------------------------------------------------------
		
		if ( false !== opts.model ) {
			
			var mdPrms = $.extend( {}, opts.model.params );
			
			var modelExt = {};
			
			modelExt = factorySetup( modelExt, opts.model, function( ext, params ) {
				
				if ( params.autourl ) {
					ext.url = opts.script.ajax_content + '&section=' + opts.name;
				}
				
				return ext;
				
			} );
			
			ent.Model = Backstab.Model.extend( modelExt );			
		}
		
		
		
		
		// --- collection --------------------------------------------------------------------------
		
		if ( false !== opts.collection ) {
		
			var clPrms = $.extend( {}, opts.collection.params );
			
			var collectionExt = { model: ent.Model };
			
			collectionExt = factorySetup( collectionExt, opts.collection, function( ext, params ) {
				
				if ( params.autourl ) {
					ext.url = opts.script.ajax_content + '&section=' + opts.name_plural;
				}

				if ( params.parseinfo ) {
					
					ext.parse = function( response, options ) {
						
						this.info = null;	// reset
						
						if ( response[ '__info' ] && response[ '__body' ] ) {
							this.info = response[ '__info' ];
							return response[ '__body' ];
						}
						
						return response;
					}
					
				}
				
				return ext;
{'fraction_non_alphanumeric': 0.20976800976800977, 'fraction_numerical': 0.0, 'mean_word_length': 1.6806282722513088, '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': '1733570', 'n_tokens_mistral': 1644, 'n_tokens_neox': 1201, 'n_words': 265}