mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 04:02:39 +01:00
Fixed conflicting .each() function by renaming to .withAll().
This commit is contained in:
parent
e6ac8558ac
commit
418906faff
@ -172,7 +172,7 @@ var poll = function(dbot) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Count votes
|
// Count votes
|
||||||
polls[name].votes.each(function (name, vote) {
|
polls[name].votes.withAll(function (name, vote) {
|
||||||
voted = false;
|
voted = false;
|
||||||
vote.each(function (pref) {
|
vote.each(function (pref) {
|
||||||
if(!voted && rounds[roundn].hasOwnProperty(pref)) {
|
if(!voted && rounds[roundn].hasOwnProperty(pref)) {
|
||||||
@ -184,7 +184,7 @@ var poll = function(dbot) {
|
|||||||
|
|
||||||
// Find the loser
|
// Find the loser
|
||||||
var min = polls[name].votes.length() + 1;
|
var min = polls[name].votes.length() + 1;
|
||||||
rounds[roundn].each(function (option, count) {
|
rounds[roundn].withAll(function (option, count) {
|
||||||
if(count < min) {
|
if(count < min) {
|
||||||
roundLoser = option;
|
roundLoser = option;
|
||||||
min = count;
|
min = count;
|
||||||
@ -197,7 +197,7 @@ var poll = function(dbot) {
|
|||||||
order = eliminated.reverse().join(', ')
|
order = eliminated.reverse().join(', ')
|
||||||
} else {
|
} else {
|
||||||
var votesArr = [];
|
var votesArr = [];
|
||||||
polls[name].votes.each(function(option, count) {
|
polls[name].votes.withAll(function(option, count) {
|
||||||
votesArr.push([option, count]);
|
votesArr.push([option, count]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ Object.prototype.isArray = function(obj) {
|
|||||||
return Object.prototype.toString.call(obj) === '[object Array]';
|
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.prototype.each = function(fun) {
|
Object.prototype.withAll = function(fun) {
|
||||||
for(key in this)
|
for(key in this)
|
||||||
if(this.hasOwnProperty(key))
|
if(this.hasOwnProperty(key))
|
||||||
fun(key, this[key]);
|
fun(key, this[key]);
|
||||||
|
Loading…
Reference in New Issue
Block a user