<commit_before>var app = require('ridge');

module.exports = Backbone.Collection.extend({
	constructor: function(attributes, options) {
		var _collection = this;

		Backbone.Collection.apply(_collection, arguments);

		if(_.isString(_collection.model)) {
			_collection.modelName = _collection.model;
			if(app.models[_collection.model])
				_collection.model = app.models[_collection.model];
			else {
				_collection.model = require('ridge/model').extend({
					name: _collection.model
				});
			}
		}

		return _collection;
	}
});<commit_msg>Override Collection.prototype.parse to allow sending totalCount from server.<commit_after>var app = require('ridge');

module.exports = Backbone.Collection.extend({
	constructor: function(attributes, options) {
		var _collection = this;

		Backbone.Collection.apply(_collection, arguments);

		if(_.isString(_collection.model)) {
			_collection.modelName = _collection.model;
			if(app.models[_collection.model])
				_collection.model = app.models[_collection.model];
			else {
				_collection.model = require('ridge/model').extend({
					name: _collection.model
				});
			}
		}

		return _collection;
	},

	parse: function(resp) {
		if(resp.totalCount) {
			this.totalCount = resp.totalCount;

			return _.find(resp, _.isArray);
		}

		return resp;
	}

});
{'fraction_non_alphanumeric': 0.13420245398773006, 'fraction_numerical': 0.0, 'mean_word_length': 4.158102766798419, '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': '450495', 'n_tokens_mistral': 455, 'n_tokens_neox': 387, 'n_words': 69}