<commit_before>var _ = require("lodash")

var transform_sub = function (rules, property_blacklist, new_object, orig_object) { 

	var sub_object = {}

	var new_properties = Object.keys(rules).filter(function (property) { return property_blacklist.indexOf(property) == -1 })

	_.each(new_properties, function (new_property) {

		if (rules[new_property].constructor === Object) {
			
			sub_object[new_property] = transform_sub(rules[new_property], property_blacklist, new_object, orig_object)

		} else if (rules[new_property].constructor === Function) {

			var parameters = rules[new_property].toString().match(/\((.*?)\)/)[1].split(",")
			var args = parameters.map(function (param) { return orig_object[param.trim()] })

			sub_object[new_property] = rules[new_property].apply(this, args)
			delete new_object[rules[new_property]]

		} else {

			sub_object[new_property] = orig_object[rules[new_property]]
			delete new_object[rules[new_property]]

		}

	})

	return sub_object
}

var construct_blacklist = function (exceptions, orig_object) {

	var property_blacklist = []

	_.each(exceptions, function (exception_func) {

		if (exception_func.constructor !== Function) {
			return
		}

		var parameters = exception_func.toString().match(/\((.*?)\)/)[1].split(",")
		var args = parameters.map(function (param) { return orig_object[param.trim()] })

		property_blacklist.push( exception_func.apply(this, args) )

	})

	return property_blacklist

}

exports.transform = {}

exports.transform.preserve = function (rules, exceptions, object) {

	var orig_object = object || exceptions
	var new_object = _.clone(orig_object)
	var property_blacklist = []

	if (object) {
		property_blacklist = construct_blacklist(exceptions, orig_object)
	}

	return _.extend(transform_sub(rules, property_blacklist, new_object, orig_object), new_object)

}

exports.transform.filter = function (rules, exceptions, object) {

	var orig_object = object || exceptions
	var new_object = _.clone(orig_object)
	var property_blacklist = []

	if (object) {
		property_blacklist = construct_blacklist(exceptions, orig_object)
	}

	return _.extend(transform_sub(rules, property_blacklist, new_object, orig_object), {})

}<commit_msg>args resolving when transform function is mapped fix<commit_after>var _ = require("lodash")

var transform_sub = function (rules, property_blacklist, new_object, orig_object) { 

	var sub_object = {}

	var new_properties = Object.keys(rules).filter(function (property) { return property_blacklist.indexOf(property) == -1 })

	_.each(new_properties, function (new_property) {

		if (rules[new_property].constructor === Object) {
			
			sub_object[new_property] = transform_sub(rules[new_property], property_blacklist, new_object, orig_object)

		} else if (rules[new_property].constructor === Function) {

			var parameters = rules[new_property].toString().match(/\((.*?)\)/)[1].split(",")
			var args = parameters.map(function (param) { return orig_object[param.trim()] })

			sub_object[new_property] = rules[new_property].apply(this, args)
			delete new_object[rules[new_property]]

		} else {

			sub_object[new_property] = orig_object[rules[new_property]]
			delete new_object[rules[new_property]]

		}

	})

	return sub_object
}

var construct_blacklist = function (exceptions, orig_object) {

	var property_blacklist = []

	_.each(exceptions, function (exception_func) {

		if (exception_func.constructor !== Function) {
			return
		}

		var parameters = exception_func.toString().match(/\((.*?)\)/)[1].split(",")
		var args = parameters.map(function (param) { return orig_object[param.trim()] })

		property_blacklist.push( exception_func.apply(this, args) )

	})

	return property_blacklist

}

exports.transform = {}

exports.transform.preserve = function (rules, exceptions, object) {

	var orig_object = typeof object == "object" ? object : exceptions
	var new_object = _.clone(orig_object)
	var property_blacklist = []

	if (object && typeof object == "object") {
		property_blacklist = construct_blacklist(exceptions, orig_object)
	}

	return _.extend(transform_sub(rules, property_blacklist, new_object, orig_object), new_object)

}

exports.transform.filter = function (rules, exceptions, object) {

	var orig_object = typeof object == "object" ? object : exceptions
	var new_object = _.clone(orig_object)
	var property_blacklist = []

	if (object && typeof object == "object") {
		property_blacklist = construct_blacklist(exceptions, orig_object)
	}

	return _.extend(transform_sub(rules, property_blacklist, new_object, orig_object), {})

}
{'fraction_non_alphanumeric': 0.13149243918474687, 'fraction_numerical': 0.0013149243918474688, 'mean_word_length': 5.3565459610027855, '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': '4691803', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1392, 'n_words': 283}