<commit_before>/**
 *  Copyright (C) 2014 3D Repo Ltd
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
var repoGraphScene = require("../repoGraphScene.js");
var async = require("async");
var search = require("./helper/search.js").search;
var log_iface = require("../logger.js");
var logger = log_iface.logger;
var C = require("../constants.js");
var repoNodeMesh = require("../repoNodeMesh.js");

var _ = require("underscore");
var dbInterface = require("../db_interface.js");

var uuid = require("node-uuid");
var utils = require("../utils.js");

// Credit goes to http://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript
function escapeHtml(text) {
	"use strict";

  var map = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    """: "&quot;",
    "\"": "&#039;"
  };

  return text.replace(/[&<>""]/g, function(m) { return map[m]; });
}


/*******************************************************************************
 * Append Metadata to child
 *
 * @param {Object} dbInterface - Database module from db_interface.js<commit_msg>ISSUE #81 - Fixed some merge conflicts<commit_after>/**
 *  Copyright (C) 2014 3D Repo Ltd
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
var repoGraphScene = require("../repoGraphScene.js");
var async = require("async");
var search = require("./helper/search.js").search;
var log_iface = require("../logger.js");
var logger = log_iface.logger;
var C = require("../constants.js");
var repoNodeMesh = require("../repoNodeMesh.js");

var _ = require("underscore");
var dbInterface = require("../db_interface.js");

var uuid = require("node-uuid");
var utils = require("../utils.js");

var responseCodes = require("../response_codes.js");

// Credit goes to http://stackoverflow.com/questions/1787322/htmlspecialchars-equivalent-in-javascript
function escapeHtml(text) {
	"use strict";

  var map = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    "'": "&quot;",
    "\"": "&#039;"
  };

  return text.replace(/[&<>""]/g, function(m) { return map[m]; });
}


/*******************************************************************************
 * Append Metadata to child
 *
 * @param {Object} dbInterface - Database module from db_interface.js
{'fraction_non_alphanumeric': 0.1858330943504445, 'fraction_numerical': 0.009750501864066534, 'mean_word_length': 3.947517730496454, 'pattern_counts': {'":': 10, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6179339', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1002, 'n_words': 351}