<commit_before>'use strict';

var superagent= require('superagent');
var Base64 = require('./Base64');
module.exports = {};

var FlavorUtils = module.exports = {};

/**
 * Clone a flavor from one user to another
 * @param {Object} opts - clone options
 * @param {Object} opts.source - source description
 * @param {string} opts.source.username - The name of the user's from which to clone
 * @param {string} opts.source.flavor - The name of the flavor to clone
 * @param {string} opts.source.couchUrl - Couchdb root url of the source. It should contain username + password if necessary
 * @param {string} opts.target.couchDatabase - the name of the target couchdb database
 * @param {string} opts.target - target description
 * @param {String} opts.target.username - The target username to which to clone the flavor
 * @param {string} opts.target.flavor - The name of the flavor in the target
 * @param {string} opts.target.couchUrl - Couchdb root url of the target. It should contain username + password if necessary
 * @param {string} opts.target.couchDatabase - the name of the target couchdb database
 */
FlavorUtils.cloneFlavor = function(opts) {
    processCommonParams(opts.source);
    processCommonParams(opts.target);
    var key = [opts.source.flavor, opts.source.username];
    getView(opts.source, 'flavor/docs', key).then(function(res) {
        var result = res.rows;
        if(!result) return;
        var done = Promise.resolve();<commit_msg>cloneFlavor should return a promise<commit_after>'use strict';

var superagent= require('superagent');
var Base64 = require('./Base64');
module.exports = {};

var FlavorUtils = module.exports = {};

/**
 * Clone a flavor from one user to another
 * @param {Object} opts - clone options
 * @param {Object} opts.source - source description
 * @param {string} opts.source.username - The name of the user's from which to clone
 * @param {string} opts.source.flavor - The name of the flavor to clone
 * @param {string} opts.source.couchUrl - Couchdb root url of the source. It should contain username + password if necessary
 * @param {string} opts.target.couchDatabase - the name of the target couchdb database
 * @param {string} opts.target - target description
 * @param {String} opts.target.username - The target username to which to clone the flavor
 * @param {string} opts.target.flavor - The name of the flavor in the target
 * @param {string} opts.target.couchUrl - Couchdb root url of the target. It should contain username + password if necessary
 * @param {string} opts.target.couchDatabase - the name of the target couchdb database
 */
FlavorUtils.cloneFlavor = function(opts) {
    processCommonParams(opts.source);
    processCommonParams(opts.target);
    var key = [opts.source.flavor, opts.source.username];
    return getView(opts.source, 'flavor/docs', key).then(function(res) {
        var result = res.rows;
        if(!result) return;
        var done = Promise.resolve();
{'fraction_non_alphanumeric': 0.10986775178026449, 'fraction_numerical': 0.0027127839945744322, 'mean_word_length': 3.9663299663299663, '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': '3654207', 'n_tokens_mistral': 822, 'n_tokens_neox': 815, 'n_words': 306}