<commit_before>// Copyright 2012 Joyent, Inc.  All rights reserved.

var EventEmitter = require('events').EventEmitter;

var assert = require('assert-plus');
var once = require('once');
var uuid = require('node-uuid');

var utils = require('./utils');



///--- Globals

var clone = utils.clone;



///--- Helpers

function copyConfig(config) {
        var cfg = clone(config);

        cfg.pre = (config.pre || []).map(function (f) {
                return (f.toString());
        });
        cfg.post = (config.post || []).map(function (f) {
                return (f.toString());
        });

        return (cfg);
}


function copyOptions(options, value) {
        var opts = {
                etag: options.etag !== undefined ? options.etag : options._etag,
                headers: options.headers || {},
                limit: options.limit,
                noCache: true,
                offset: options.offset,
                req_id: options.req_id || uuid.v1(),
                sort: options.sort,
                token: options.token,
                vnode: options.vnode
        };

        if (value)
                opts._value = JSON.stringify(value);
        if (typeof (options.noCache) !== 'undefined')
                opts.noCache = options.noCache;

        return (opts);
}



///--- API
// All of the functions here are scoped to the file as they require an
// underlying 'fast' connection to be given to them.  The functions on<commit_msg>MORAY-99 support hashkey in search<commit_after>// Copyright 2012 Joyent, Inc.  All rights reserved.

var EventEmitter = require('events').EventEmitter;

var assert = require('assert-plus');
var once = require('once');
var uuid = require('node-uuid');

var utils = require('./utils');



///--- Globals

var clone = utils.clone;



///--- Helpers

function copyConfig(config) {
        var cfg = clone(config);

        cfg.pre = (config.pre || []).map(function (f) {
                return (f.toString());
        });
        cfg.post = (config.post || []).map(function (f) {
                return (f.toString());
        });

        return (cfg);
}


function copyOptions(options, value) {
        var opts = {
                etag: options.etag !== undefined ? options.etag : options._etag,
                hashkey: options.hashkey,
                headers: options.headers || {},
                limit: options.limit,
                noCache: true,
                offset: options.offset,
                req_id: options.req_id || uuid.v1(),
                sort: options.sort,
                token: options.token,
                vnode: options.vnode
        };

        if (value)
                opts._value = JSON.stringify(value);
        if (typeof (options.noCache) !== 'undefined')
                opts.noCache = options.noCache;

        return (opts);
}



///--- API
// All of the functions here are scoped to the file as they require an
// underlying 'fast' connection to be given to them.  The functions on
{'fraction_non_alphanumeric': 0.13716962194713953, 'fraction_numerical': 0.004014720642355303, 'mean_word_length': 1.7970065481758652, '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': '55431', 'n_tokens_mistral': 858, 'n_tokens_neox': 811, 'n_words': 229}