<commit_before>/**
 * grunt-uncss
 * https://github.com/addyosmani/grunt-uncss
 *
 * Copyright (c) 2015 <NAME>
 * Licensed under the MIT license.
 */

'use strict';
var uncss  = require( 'uncss' ),
    chalk  = require( 'chalk' ),
    maxmin = require( 'maxmin' );

module.exports = function ( grunt ) {
    grunt.registerMultiTask( 'uncss', 'Remove unused CSS', function () {

        var done    = this.async(),
            options = this.options({
                report: 'min'
            });

        options.urls = options.urls || [];

        this.files.forEach(function ( file ) {

            var src = file.src.filter(function ( filepath ) {
                // Warn on and remove invalid source files (if nonull was set).
                if ( !grunt.file.exists( filepath ) ) {
                    grunt.log.warn( 'Source file ' + chalk.cyan( filepath ) + ' not found.' );
                    return false;
                } else {
                    return true;
                }
            });

            if ( src.length === 0 && file.orig.src.length === 0 ) {
                grunt.fail.warn( 'Destination (' + file.dest + ') not written because src files were empty.' );
            }

            file.orig.src.forEach(function (source) {
                if (/^https?/.test(source)) {
                    src.push(source);
                    options.urls.push(source);
                }
            });

            try {
                uncss( src, options, function ( error, output, report ) {
                    if ( error ) {
                        throw error;
                    }

                    grunt.file.write( file.dest, output );
                    grunt.log.writeln('File ' + chalk.cyan( file.dest ) + ' created: ' + maxmin( report.original, output, options.report === 'gzip' ) );
                    if (typeof(options.reportFile) !== 'undefined' && options.reportFile.length > 0) {
                        grunt.file.write(options.reportFile, JSON.stringify(report));
                    }
                    done();
                });<commit_msg>Fix issue #141 Object has no method 'forEach'<commit_after>/**
 * grunt-uncss
 * https://github.com/addyosmani/grunt-uncss
 *
 * Copyright (c) 2015 <NAME>
 * Licensed under the MIT license.
 */

'use strict';
var uncss  = require( 'uncss' ),
    chalk  = require( 'chalk' ),
    maxmin = require( 'maxmin' );

module.exports = function ( grunt ) {
    grunt.registerMultiTask( 'uncss', 'Remove unused CSS', function () {

        var done    = this.async(),
            options = this.options({
                report: 'min'
            });

        options.urls = options.urls || [];

        this.files.forEach(function ( file ) {

            var src = file.src.filter(function ( filepath ) {
                // Warn on and remove invalid source files (if nonull was set).
                if ( !grunt.file.exists( filepath ) ) {
                    grunt.log.warn( 'Source file ' + chalk.cyan( filepath ) + ' not found.' );
                    return false;
                } else {
                    return true;
                }
            });

            if ( src.length === 0 && file.src.length === 0 ) {
                grunt.fail.warn( 'Destination (' + file.dest + ') not written because src files were empty.' );
            }

            file.src.forEach(function (source) {
                if (/^https?/.test(source)) {
                    src.push(source);
                    options.urls.push(source);
                }
            });

            try {
                uncss( src, options, function ( error, output, report ) {
                    if ( error ) {
                        throw error;
                    }

                    grunt.file.write( file.dest, output );
                    grunt.log.writeln('File ' + chalk.cyan( file.dest ) + ' created: ' + maxmin( report.original, output, options.report === 'gzip' ) );
                    if (typeof(options.reportFile) !== 'undefined' && options.reportFile.length > 0) {
                        grunt.file.write(options.reportFile, JSON.stringify(report));
                    }
                    done();
                });
{'fraction_non_alphanumeric': 0.1323040380047506, 'fraction_numerical': 0.0040380047505938245, 'mean_word_length': 1.3630751964085297, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '2524342', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1102, 'n_words': 261}