<commit_before>/**
 * `chain` is the instance of npm squel module
 * `resource` includes the data to build the query
 */
var lme = require('lme');
var squel = require('squel').useFlavour('postgres');
var handles = require('./handles');

var key;

var sqlify = function (chain, resource) {
	// refrain from sins
	// sometimes if resource contains req.body, this is required to make clear object (as of now)
	resource = JSON.parse(JSON.stringify(resource));

	// iterate through each properties of `resource`
	for (key in resource) {
		if (!resource.hasOwnProperty(key)) {
			continue;
		}
		switch (key) {
		case 'fields':
			handles.field(chain, resource[key]);
			break;

		case 'where':
			handles.where(chain, resource[key]);
			break;

		case 'set':
			handles.set(chain, resource[key]);
			break;

		case 'join':
			handles.join(chain, resource[key]);
			break;

		case 'left_join':
			handles.left_join(chain, resource[key]);
			break;

		case 'right_join':
			handles.right_join(chain, resource[key]);
			break;

		case 'outer_join':
			handles.outer_join(chain, resource[key]);
			break;

		case 'cross_join':
			handles.cross_join(chain, resource[key]);
			break;

		case 'returning':
			handles.returning(chain, resource[key]);
			break;

		default:
			lme.e('method ' + key + ' is not implemented');
			break;
		}
	}
};

// expose squel and sqlify
module.exports = {
	squel: squel,
	sqlify: sqlify
};<commit_msg>addressing issue 3 partially to see how node versions responds to it<commit_after>/**
 * `chain` is the instance of npm squel module
 * `resource` includes the data to build the query
 */
var lme = require('lme');
var squel = require('squel').useFlavour('postgres');
var handles = require('./handles');

var sqlify = function(chain, resource) {

    // iterate through each properties of `resource`
	Object.keys(resource).forEach(function(key) {
		switch (key) {
		case 'fields':
			handles.field(chain, resource[key]);
			break;

		case 'where':
			handles.where(chain, resource[key]);
			break;

		case 'set':
			handles.set(chain, resource[key]);
			break;

		case 'join':
			handles.join(chain, resource[key]);
			break;

		case 'left_join':
			handles.left_join(chain, resource[key]);
			break;

		case 'right_join':
			handles.right_join(chain, resource[key]);
			break;

		case 'outer_join':
			handles.outer_join(chain, resource[key]);
			break;

		case 'cross_join':
			handles.cross_join(chain, resource[key]);
			break;

		case 'returning':
			handles.returning(chain, resource[key]);
			break;

		default:
			lme.e('method ' + key + ' is not implemented');
			break;
		}
	});
};

// expose squel and sqlify
module.exports = {
	squel: squel,
	sqlify: sqlify
};
{'fraction_non_alphanumeric': 0.1451373422420193, 'fraction_numerical': 0.0003711952487008166, 'mean_word_length': 3.8125, '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': '6833870', 'n_tokens_mistral': 1028, 'n_tokens_neox': 890, 'n_words': 240}