<commit_before>/**
 * Copyright (c) ActiveState 2013 - ALL RIGHTS RESERVED.
 */

define([
    'underscore',
    './page'],
    function (_, Page) {

        var api_version_prefix = '/v2/';

        var collection = function () {

        };

        collection.prototype = {

            makeQueryString: function (options) {

                options = options || {};

                var query = '',
                    first_q = true;

                if (options.queries) {
                    _.each(options.queries, function (value, key) {
                        query = query + ((first_q ? '?' : '&') + key + '=' + value);
                        first_q = false;
                    });
                }

                if (options.filter && options.filter.name && options.filter.value) {
                    query = query + ((first_q ? '?' : '&') + 'q=' + options.filter.name + ':' + options.filter.value);
                }

                return query;
            },

            getCollectionUrl: function (){
                return api_version_prefix + this.collection;
            },

            get: function (guid, options, done) {

                var path = api_version_prefix + this.collection + '/' + guid,
                    query = this.makeQueryString(options);

                this.api.get(path, {query: query, status_code: 200}, function (err, res) {
                    if (err) {return done(err);}<commit_msg>Allow an empty filter value to be passed for cases where you actually want to filter to an empty string<commit_after>/**
 * Copyright (c) ActiveState 2013 - ALL RIGHTS RESERVED.
 */

define([
    'underscore',
    './page'],
    function (_, Page) {

        var api_version_prefix = '/v2/';

        var collection = function () {

        };

        collection.prototype = {

            makeQueryString: function (options) {

                options = options || {};

                var query = '',
                    first_q = true;

                if (options.queries) {
                    _.each(options.queries, function (value, key) {
                        query = query + ((first_q ? '?' : '&') + key + '=' + value);
                        first_q = false;
                    });
                }

                if (options.filter && options.filter.name) {
                    query = query + ((first_q ? '?' : '&') + 'q=' + options.filter.name + ':' + options.filter.value);
                }

                return query;
            },

            getCollectionUrl: function (){
                return api_version_prefix + this.collection;
            },

            get: function (guid, options, done) {

                var path = api_version_prefix + this.collection + '/' + guid,
                    query = this.makeQueryString(options);

                this.api.get(path, {query: query, status_code: 200}, function (err, res) {
                    if (err) {return done(err);}
{'fraction_non_alphanumeric': 0.12931618144888288, 'fraction_numerical': 0.005416384563303994, 'mean_word_length': 1.3564593301435406, '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': '3577203', 'n_tokens_mistral': 818, 'n_tokens_neox': 736, 'n_words': 183}