<commit_before>/*global require, module, process*/
module.exports = function memoizeAsyncAccessor(name, computer) {
    return function (cb) {
        var that = this;
        if (name in that) {
            process.nextTick(function () {
                cb(null, that[name]);
            });
        } else {
            var waitingQueuePropertyName = '_' + name + '_queue';
            if (waitingQueuePropertyName in that) {
                that[waitingQueuePropertyName].push(cb);
            } else {
                that[waitingQueuePropertyName] = [cb];
                computer.call(that, function (err, result) {
                    that[name] = result;
                    that[waitingQueuePropertyName].forEach(function (waitingCallback) {
                        waitingCallback(err, result);
                    });
                    delete that[waitingQueuePropertyName];
                });
            }
        }
    };
};<commit_msg>memoizeAsyncAccessor: Avoid passing undefined to the callback if the memoized value is deleted while waiting for process.nextTick.<commit_after>/*global require, module, process*/
module.exports = function memoizeAsyncAccessor(name, computer) {
    return function (cb) {
        var that = this;
        if (name in that) {
            var value = that[name];
            process.nextTick(function () {
                cb(null, value);
            });
        } else {
            var waitingQueuePropertyName = '_' + name + '_queue';
            if (waitingQueuePropertyName in that) {
                that[waitingQueuePropertyName].push(cb);
            } else {
                that[waitingQueuePropertyName] = [cb];
                computer.call(that, function (err, result) {
                    that[name] = result;
                    that[waitingQueuePropertyName].forEach(function (waitingCallback) {
                        waitingCallback(err, result);
                    });
                    delete that[waitingQueuePropertyName];
                });
            }
        }
    };
};
{'fraction_non_alphanumeric': 0.10077896786757547, 'fraction_numerical': 0.0, 'mean_word_length': 1.6178343949044587, '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': '7362069', 'n_tokens_mistral': 505, 'n_tokens_neox': 486, 'n_words': 111}