<commit_before>import { Class } from 'orbit/lib/objects';
import SchemaUtils from 'orbit-firebase/schema-utils';
import { removeItem } from 'orbit-firebase/array-utils';

export default Class.extend({
	init: function(firebaseClient, schema){
		this._firebaseClient = firebaseClient;
		this._schemaUtils = new SchemaUtils(schema);
	},

	handles: function(operation){
		var path = operation.path;
		if(path[2] !== '__rel') return; 
		var linkType = this._schemaUtils.lookupLinkDef(path[0], path[3]).type;
		return operation.op === "add" && linkType === 'hasMany';
	},

	transform: function(operation){
		var path = removeItem(operation.path, '__rel');
		return this._firebaseClient.appendToArray(path, operation.value);
	}
});<commit_msg>Correct add to has many<commit_after>import { Class } from 'orbit/lib/objects';
import SchemaUtils from 'orbit-firebase/schema-utils';
import { removeItem } from 'orbit-firebase/array-utils';

export default Class.extend({
	init: function(firebaseClient, schema){
		this._firebaseClient = firebaseClient;
		this._schemaUtils = new SchemaUtils(schema);
	},

	handles: function(operation){
		var path = operation.path;
		if(path[2] !== '__rel') return; 
		var linkType = this._schemaUtils.lookupLinkDef(path[0], path[3]).type;
		return operation.op === "add" && linkType === 'hasMany';
	},

	transform: function(operation){
		var path = removeItem(operation.path, '__rel');
		return this._firebaseClient.set(path, operation.value);
	}
});
{'fraction_non_alphanumeric': 0.14945652173913043, 'fraction_numerical': 0.004076086956521739, 'mean_word_length': 5.488986784140969, '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': '6954421', 'n_tokens_mistral': 486, 'n_tokens_neox': 456, 'n_words': 102}