<commit_before>var AvailabilityStrategy = function() {

    return function() {
        var sku;
        var storeIds;
        var options = {
            path: '/',
            qs: {}
        };

        var method;

        for (var i = 0; i < arguments.length; i++) {
            var arg = arguments[i];
            if (!isNaN(arg) && typeof arg === 'number') {
                // SKU
                sku = arg;
            } else if (Array.isArray(arg)) {
                // Store IDs
                storeIds = arg.join(',');
            } else if (typeof arg === 'function') {
                // Result callback
                options.callback = arg;
            } else {
                // Assume any object literal is a set of query params
                options.qs = arg;
            }
        }

        if (!options.qs.show) {
            options.qs.show = 'name,sku,stores';
        }

        options.path = '/products(sku=' + sku + ')+stores(storeId in(' + storeIds + '))';

        // Execute request
        return options;
    };
};

module.exports = AvailabilityStrategy;<commit_msg>Firming up our expected order of arguments for the availability method<commit_after>'use strict';

var AvailabilityStrategy = function() {

    return function(sku, storeIds) {
        var options = {
            path: '/',
            qs: {}
        };

        if (typeof sku !== 'number' && typeof sku !== 'string') {
            throw 'First parameter of "availability" must be the SKU, and it must be either a number or a string';
        }

        if (typeof storeIds !== 'number' && Array.isArray(storeIds) === false) {
            throw 'Second parameter of "availability" must be store id(s), and it must be either a number or array of numbers';
        } else if (Array.isArray(storeIds)) {
            storeIds = storeIds.join(',');
        }

        if (arguments.length === 4) {
            options.qs = arguments[2];
            options.callback = arguments[3];
        } else if (arguments.length === 3) {
            if (typeof arguments[2] === 'function') {
                options.callback = arguments[2];
            } else if (typeof arguments[2] === 'object') {
                options.qs = arguments[2];
            } else {
                throw 'Unrecognized third parameter when calling "availability" method';
            }
        }

        if (!options.qs.show) {
            options.qs.show = 'name,sku,stores';
        }

        options.path = '/products(sku=' + sku + ')+stores(storeId in(' + storeIds + '))';

        // Execute request
        return options;
    };
};

module.exports = AvailabilityStrategy;
{'fraction_non_alphanumeric': 0.12948282370705927, 'fraction_numerical': 0.0033975084937712344, 'mean_word_length': 1.5980392156862746, 'pattern_counts': {'":': 0, '<': 4, '<?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': '3191577', 'n_tokens_mistral': 731, 'n_tokens_neox': 698, 'n_words': 205}