<commit_before>// dependencies
var fs = require("fs");

// module for commentDoc

module.exports = {
    extract: function (fileToRead, fileToWrite) {

        fs.readFile(fileToRead, function (err, data) {
            if (data) {
                var text = data.toString();
                var commentArray = text.match(new RegExp(/\/\/...*\b/i));
                var counter = 0;
                for (var i = 0; i < commentArray.length; i++) {
                    commentArray[i].replace(/\/\//, '')
                    if (commentArray[i].indexOf('//') < 0) {
                        counter++
                    }
                }
                if (counter === commentArray.length) {
                    var longString = ''
                    for (var i = 0; i < commentArray.length; i++) {
                        longString += commentArray[i] + '\n'
                    };
                    fs.writeFile(fileToWrite, longString, function (err) {
                        if (err) {
                            console.error(err)
                        };
                    })
                    fs.readFile(fileToWrite, function (err, data) {
                        if (data) {
                            var text = data.toString();
                            if (text === longString) {
                                console.log(fileToWrite + ' written succesfully.');
                            }
                        }
                    })
                }
            }

        });
    };

}<commit_msg>minor fix<commit_after>// dependencies
var fs = require("fs");

// module for commentDoc
module.exports = {
    extract: function (fileToRead, fileToWrite) { // params taken as strings

        fs.readFile(fileToRead, function (err, data) {
            if (data) {
                var text = data.toString();
                var commentArray = text.match(new RegExp(/\/\/...*\b/i));
                var counter = 0;
                for (var i = 0; i < commentArray.length; i++) {
                    commentArray[i].replace(/\/\//, '')
                    if (commentArray[i].indexOf('//') < 0) {
                        counter++
                    }
                }
                if (counter === commentArray.length) {
                    var longString = ''
                    for (var i = 0; i < commentArray.length; i++) {
                        longString += commentArray[i] + '\n'
                    };
                    fs.writeFile(fileToWrite, longString, function (err) {
                        if (err) {
                            console.error(err)
                        };
                    })
                    fs.readFile(fileToWrite, function (err, data) {
                        if (data) {
                            var text = data.toString();
                            if (text === longString) {
                                console.log(fileToWrite + ' written succesfully.');
                            }
                        }
                    })
                }
            }

        });
    }
}
{'fraction_non_alphanumeric': 0.12006472491909385, 'fraction_numerical': 0.0025889967637540453, 'mean_word_length': 0.8882101405009163, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6128091', 'n_tokens_mistral': 776, 'n_tokens_neox': 715, 'n_words': 161}