<commit_before>var Poll = function() {
	//Constructor
};

Poll.prototype = {
	bars: require("bars"),
	active: [],
	irc: global.irc,
	handle: function(from, chan, message) {
		var matches;
		if (matches = message.match(/^!([\S]*) (.+)$/i)) {
			var subject = matches[2].trim();
			if (matches[1] === "poll") {

				// are they trying to end a poll?
				if (subject === "end") {
					this.finish(from, chan);
				} else {
					this.start(subject, from, chan);
				}
			} else if (matches[1] === "vote") {
				this.vote(subject, from, chan);
			}
		}
	},
	start: function(subject, user, chan) {
		if (this.active[chan]) {
			this.irc.client.say(chan, "Poll already in progress: " + this.active[chan].subject);
			return;
		}

		this.active[chan] = { subject: subject, chan: chan, author: user, votes: [] };

		this.irc.client.say(chan, "Poll started: " + this.active[chan].subject);
		this.irc.client.say(chan, "Use !vote <vote> to cast your vote!");
	},
	finish: function(user, chan) {
		// check current user started poll
		if (!this.active[chan] || this.active[chan].author !== user) {
			return;
		}

		this.irc.client.say(chan, "Poll ended: " + this.active[chan].subject);

		var votes = this.active[chan].votes;
		if (votes) {
			// build results from users votes
			var data = {};

			console.log(votes);
			console.log(votes.length);

			for (var n in votes) {
                            var k = votes[n].trim().toLowerCase();

                            if (data[k]) {
                                data[k]++;
                            } else {
                                data[k] = 1;
                            }
			}

			console.log(chan, data);
			this.irc.client.say(chan, this.bars(data, {bar: "=", width: 20, sort: true }));
		} else {
			this.irc.client.say(chan, "No votes were cast");
		}

		// clear data
		this.active[chan] = null;
	},
	vote: function(vote, user, chan) {
		if (!this.active[chan]) {
			return;
		}

		// record vote
		this.active[chan].votes[user] = vote;
		console.log(this.active);
	}
};

module.exports = new Poll();
<commit_msg>JShint fixes on poll.js<commit_after>var Poll = function() {
    //Constructor
};

Poll.prototype = {
    bars: require("bars"),
    active: [],
    irc: global.irc,
    handle: function(from, chan, message) {
        var matches;
        if (matches = message.match(/^!([\S]*) (.+)$/i)) {
            var subject = matches[2].trim();
            if (matches[1] === "poll") {

                // are they trying to end a poll?
                if (subject === "end") {
                    this.finish(from, chan);
                } else {
                    this.start(subject, from, chan);
                }
            } else if (matches[1] === "vote") {
                this.vote(subject, from, chan);
            }
        }
    },
    start: function(subject, user, chan) {
        if (this.active[chan]) {
            this.irc.client.say(chan, "Poll already in progress: " + this.active[chan].subject);
            return;
        }

        this.active[chan] = { subject: subject, chan: chan, author: user, votes: [] };

        this.irc.client.say(chan, "Poll started: " + this.active[chan].subject);
        this.irc.client.say(chan, "Use !vote <vote> to cast your vote!");
    },
    finish: function(user, chan) {
        // check current user started poll
        if (!this.active[chan] || this.active[chan].author !== user) {
            return;
        }

        this.irc.client.say(chan, "Poll ended: " + this.active[chan].subject);

        var votes = this.active[chan].votes;
        if (votes) {
            // build results from users votes
            var data = {};

            console.log(votes);
            console.log(votes.length);

            for (var n in votes) {
                var k = votes[n].trim().toLowerCase();

                if (data[k]) {
                    data[k]++;
                } else {
                    data[k] = 1;
                }
            }

            console.log(chan, data);
            this.irc.client.say(chan, this.bars(data, {bar: "=", width: 20, sort: true }));
        } else {
            this.irc.client.say(chan, "No votes were cast");
        }

        // clear data
        this.active[chan] = null;
    },
    vote: function(vote, user, chan) {
        if (!this.active[chan]) {
            return;
        }

        // record vote
        this.active[chan].votes[user] = vote;
        console.log(this.active);
    }
};

module.exports = new Poll();

{'fraction_non_alphanumeric': 0.16603857237863, 'fraction_numerical': 0.002660164043449346, 'mean_word_length': 1.8024844720496895, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7508594', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1409, 'n_words': 325}